如何在给定的作者在git中获得给定作者的全部增加和删除 [英] How to get total additions and deletions on a given branch for an given author in git

查看:164
本文介绍了如何在给定的作者在git中获得给定作者的全部增加和删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在git中计算给定分支上给定用户的全部删除和添加项?类似的东西在github上,在图表部分有一个图表,显示你的总增加和删除,但只在主分支上...我认为如果他们做到了这一点,在git中也是可能的,因此,是否有人知道该怎么做?

Is there a way in git to count the total deletions and additions for a given user on a given branch? Something like that is on github, in the graph section there is a chart that shows you the total additions and deletions but only on the master branch... i think if they did it this mus be possible in git also, so, does someone know how to do that?

预先感谢您。

Thank you in advance.

推荐答案

我不认为Git有任何内置命令可以做到这一点。但在其他一些标准工具的帮助下,它可以完成。下面是一个通过awk过滤Git日志输出以获得总插入和删除摘要的示例:

I don't think Git has any built-in command that does this. But with the help of some other standard utilities, it can be done. Here is an example that filters Git's log output through awk to get the summary of total insertions and deletions:

git log --author=$USER --shortstat $BRANCH | \
awk '/^ [0-9]/ { f += $1; i += $4; d += $6 } \
END { printf("%d files changed, %d insertions(+), %d deletions(-)", f, i, d) }'

这篇关于如何在给定的作者在git中获得给定作者的全部增加和删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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