Explore Courses Blog Tutorials Interview Questions
+1 vote
in DevOps and Agile by (19.4k points)

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.

1 Answer

0 votes
by (27.5k points)

This following command should do the magic:

$ git ls-files -z | xargs -0n1 git blame -w | ruby -n -e '$_ =~ /^.*\((.*?)\s[\d]{4}/; puts $1.strip' | sort -f | uniq -c | sort -n

Browse Categories