I am trying to find the total number of lines added and total number of lines removed by a user in a git repository. I looked at http://stackoverflow.com/questions/1265040/how-to-count-total-lines-changed-by-a-specific-author-in-a-git-repository, which had the command git log --author="<authorname>" --pretty=tformat: --numstat
, but the answer failed to give a script(however simple) to total the lines changed. What's the simplest way to sum up the lines added/removed?
views:
31answers:
1
+1
A:
$ git log --author="<authorname>" --pretty=tformat: --numstat | perl -ane'
> $i += $F[0]; $d += $F[1]; END{ print "added: $i removed: $d\n"}'
J.F. Sebastian
2010-05-09 04:29:50