我需要通过给定的散列SHA在Git中找到提交。例如,如果我有“a2c25061”哈希,我需要获取此提交的作者和提交者。
获得该命令的命令是什么?
答案 0 :(得分:317)
只需使用以下命令
即可git show a2c25061
答案 1 :(得分:48)
git log -1 --format="%an %ae%n%cn %ce" a2c25061
Pretty Formats section of the git show
documentation包含
format:<string>
format:<string>
格式允许您指定要显示的信息。它的工作方式有点像printf格式,但值得注意的是,您使用%n
而不是\n
获取换行符...占位符是:
%an
:作者姓名%ae
:作者电子邮件%cn
:提交者名称%ce
:提交者电子邮件
答案 2 :(得分:0)
有两种方法可以做到这一点。
1。提供您要在git log中看到的提交的SHA
git log -p a2c25061
-p
是补丁的缩写
2。使用git show
git show a2c25061
这两个命令的输出将是: