How can I sum lines added / deleted by user in git repository?

I am trying to find the total number of lines added and the total number of lines deleted by the user in the git repository. I looked. How to count the common lines changed by a specific author in a git repository? , which had the command git log --author="<authorname>" --pretty=tformat: --numstat , but the script could not give the answer (albeit simple) to reduce the number of lines. What is the easiest way to sum up lines added / deleted?

+4
source share
2 answers
 $ git log --author="<authorname>" --pretty=tformat: --numstat | perl -ane' > $i += $F[0]; $d += $F[1]; END{ print "added: $i removed: $d\n"}' 
+5
source

Also runs with awk:

 git log --author="<authorname>" --pretty=tformat: --numstat | awk -F" " '{ added += $1; removed += $2 } END { print "added: ", added, "removed:", removed }' 
+1
source

Source: https://habr.com/ru/post/1309227/


All Articles