是否有一个我可以调用的命令,它将计算Git存储库中特定作者更改的行数?我知道必须有方法来计算Github为其Impact图所做的提交次数。 输出下面的命令应该相当容易发送给脚本来合计总和:
git log --author =< AUTHORNAME>中--oneline --shortstat这给出了当前HEAD上所有提交的统计信息。如果您想在其他分支中添加统计信息,您必须将它们作为参数提供给 git log 。
为了传递给脚本,甚至可以使用空的日志格式删除oneline格式,并且如JakubNarębski所述, --numstat 是另一种选择。它生成每个文件而不是每行统计信息,但更易于解析。
git log --author =< ; AUTHORNAME>中--pretty = tformat:--numstat
Is there a command I can invoke which will count the lines changed by a specific author in a Git repository? I know that there must be ways to count the number of commits as Github does this for their Impact graph.
解决方案The output of the following command should be reasonably easy to send to script to add up the totals:
git log --author="<authorname>" --oneline --shortstatThis gives stats for all commits on the current HEAD. If you want to add up stats in other branches you will have to supply them as arguments to git log.
For passing to a script, removing even the "oneline" format can be done with an empty log format, and as commented by Jakub Narębski, --numstat is another alternative. It generates per-file rather than per-line statistics but is even easier to parse.
git log --author="<authorname>" --pretty=tformat: --numstat
更多推荐
如何统计Git存储库中特定作者更改的总行数?
发布评论