Alex Rivera | Logout

How to count total lines changed by a specific author in a Git repository?

Asked 2009-08-12T08:59:44.723
654

Is there a command I can invoke which will count the lines changed by a specific author in a Git repository? I know that there must be ways to count the number of commits as Github does this for their Impact graph.

Edit
Report

1 Answer

18

A solution was given with ruby in the middle, perl being a little more available by default here is an alternative using perl for current lines by author.

git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n
answered 2012-03-19T19:38:56.510

Your Answer