【发布时间】:2011-08-01 12:05:31
【问题描述】:
有没有办法找到最近在 git 中更改了文件的人?
例如,我需要最后 5 个更改此文件的人。我尝试了git annotate 和git blame,但找不到我想要的确切内容。
【问题讨论】:
有没有办法找到最近在 git 中更改了文件的人?
例如,我需要最后 5 个更改此文件的人。我尝试了git annotate 和git blame,但找不到我想要的确切内容。
【问题讨论】:
可能不是最有效或最明智的方式,但这似乎可行:
$ git log <filepath> | grep Author: | cut -d' ' -f2- | uniq | head -n5
这是假设您实际上想要最后 5 个作者,无论他们每个人可能进行了多少次提交。如果您只想要最后 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
索斯滕
【讨论】: