【发布时间】:2014-07-09 02:11:20
【问题描述】:
有没有办法按目录查看作者在 Git 中编写了多少 行代码?所以,不是 git repo 中的所有内容,只是 git 项目的一个特定子文件夹,格式类似于 shortlog?
【问题讨论】:
-
您想要计算当前版本中每位作者最后一次触及的行数吗?
有没有办法按目录查看作者在 Git 中编写了多少 行代码?所以,不是 git repo 中的所有内容,只是 git 项目的一个特定子文件夹,格式类似于 shortlog?
【问题讨论】:
如果您想按作者计算当前代码行数,我相信以下内容会满足您的需求。 (可能有更好的方法,但这是我首先想到的。)
{ 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]}}'
【讨论】:
您可以致电:
git log --author="<author name>" --pretty=tformat: --numstat app/src
【讨论】: