是否可以通过目录查看作者在Git中编写了多少行代码?那么,不是git repo中的所有内容,只是一个像shortlog这样格式的git项目的一个特定子文件夹?
答案 0 :(得分:4)
如果您想按作者计算当前代码行数,我相信以下内容可以满足您的需求。 (可能有更好的方法,但这是我想到的第一件事。)
{ for file in *; do git annotate --line-porcelain "$file" 2>/dev/null; done; } | awk '$1 == "author" {authors[$2]++; } END {for (author in authors) {print author ": " authors[author]}}'
答案 1 :(得分:0)
您可以致电:
git log --author="<author name>" --pretty=tformat: --numstat app/src