Hi everyone,
I was wondering if there is any tools out there that can report on the LOC for Added, Modified and Deleted code from a GIT check in.
It would be awesome if it could then add the count to a some sort of DB
Hi everyone,
I was wondering if there is any tools out there that can report on the LOC for Added, Modified and Deleted code from a GIT check in.
It would be awesome if it could then add the count to a some sort of DB
git show --stat <commit>
displays changed files, insertions and deletions per-file, and totals. If you want to call this from a script, you can use --numstat
instead which outputs it in a machine-readable format. (You also probably want to add --pretty=oneline
, so your script can just skip the first line of output, after which the counts per file will be displayed).
See git help show
and git help diff
for more information.
As mkarasek mentions in his answer, any additional logic in git show --stat
needs to be scripted.
You can start by having a look at this Python script: GitHub project git-loc.
You could inject some logic when parsing the git log --reverse -p
he uses to compute the number of loc.