每位作者的GIT贡献(行) [英] GIT contribution per author (lines)

查看:97
本文介绍了每位作者的GIT贡献(行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将每位作者的每行贡献打印到Git存储库中.

I'm trying to print the per-line contribution of each author to a Git repository.

为此,我使用以下命令,改编自

For that, I use the following command, adapted from How to count total lines changed by a specific author in a Git repository?

git ls-tree -r -z --name-only HEAD -- */*.c | xargs -0 -n1 git blame \
--line-porcelain HEAD |grep  "^author "|sort|uniq -c|sort -nr

但是,出现以下错误:

fatal: cannot stat path 'HEAD': No such file or directory.

我做错了什么?

推荐答案

好的,经过更多调查,我在SO上找到了它.

Okay, after more investigation I found this on SO.

git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*?\((.*?)\s+[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n  

答案来自 Eric Z

结果

    234926 USER 1
     32453 USER 2
   2941234 USER 3

这篇关于每位作者的GIT贡献(行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆