[英]how to find recent committers of a file in git?
有没有办法找到谁最近在 git 中更改了文件?
例如,我需要最后 5 个更改此文件的人。 我尝试了git annotate
和git blame
但我找不到我想要的确切内容。
可能不是最有效或最明智的方式,但这似乎有效:
$ git log <filepath> | grep Author: | cut -d' ' -f2- | uniq | head -n5
这是假设您实际上想要最后 5 个author ,而不管他们每个人可能进行了多少次提交。 如果您只想要最后 5 次提交,则可以单独使用git log
:
$ git log -5 <filepath>
git shortlog 做你想要的:
git shortlog -sne <filename>
尝试:
git log filename
您可以使用日志输出(参见 man git-log)来获取您想要的信息。
我发现这对于显示单个文件的最后 5 个作者很有用
git log -n 5 --pretty='format:%an' -- path/to/file
-n <number>
- 要显示的提交数(在本例中为作者)
--pretty='format:%an'
- 只显示作者姓名
我在用着
gitk filename
托尔斯滕
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.