我试图在git存储库中找到用户删除的总行数和总行数。我查看了How to count total lines changed by a specific author in a Git repository?,其中有git log --author="<authorname>" --pretty=tformat: --numstat
命令,但答案未能给出一个脚本(无论多么简单)总计更改的行。总结添加/删除的行的最简单方法是什么?
答案 0 :(得分:6)
$ git log --author="<authorname>" --pretty=tformat: --numstat | perl -ane'
> $i += $F[0]; $d += $F[1]; END{ print "added: $i removed: $d\n"}'
答案 1 :(得分:2)
也可以使用awk:
git log --author="<authorname>" --pretty=tformat: --numstat | awk -F" " '{ added += $1; removed += $2 } END { print "added: ", added, "removed:", removed }'