【问题标题】:Is there a way to see how many lines of code were written by an author in Git by directory?有没有办法按目录查看作者在 Git 中编写了多少行代码?
【发布时间】:2014-07-09 02:11:20
【问题描述】:

有没有办法按目录查看作者在 Git 中编写了多少 行代码?所以,不是 git repo 中的所有内容,只是 git 项目的一个特定子文件夹,格式类似于 shortlog?

【问题讨论】:

  • 您想要计算当前版本中每位作者最后一次触及的行数吗?

标签: git bash shell


【解决方案1】:

如果您想按作者计算当前代码行数,我相信以下内容会满足您的需求。 (可能有更好的方法,但这是我首先想到的。)

{ 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]}}'

【讨论】:

    【解决方案2】:

    您可以致电:

    git log --author="<author name>" --pretty=tformat: --numstat app/src
    

    【讨论】:

      猜你喜欢
      • 2011-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-22
      • 2020-06-14
      • 1970-01-01
      • 2020-07-30
      • 1970-01-01
      相关资源
      最近更新 更多