Pat*_*ryk 19 git sha1 author commit
我想检查一下作者的电子邮件和姓名,以确认谁正在推送我的回购.
有没有办法让我在git中提出一个命令来显示提交者的名字/电子邮件,只提供提交的SHA1?
这就是我提出的,但它远非理想的解决方案(第一个解决方案是git hook,这就是为什么它使用2个SHA1 rev-list.第二个只是使用git show):
git rev-list -n 1 --pretty=short ccd3970..6ddf170 | grep Author | cut -d ' ' -f2- | rev | cut -d ' ' -f2- | rev
git show 6ddf170 | grep Author | cut -d ' ' -f2- | rev | cut -d ' ' -f2- | rev
Run Code Online (Sandbox Code Playgroud)
Iga*_* S. 28
您可以使用以下命令:
git log --format='%ae' HASH^!
Run Code Online (Sandbox Code Playgroud)
它也适用git show.您需要包含-s以抑制差异.
git show -s --format='%ae' HASH
Run Code Online (Sandbox Code Playgroud)
小智 14
这将显示 - sha、提交者电子邮件、作者电子邮件
git log --pretty=format:"%h %ce %ae" HASH
Run Code Online (Sandbox Code Playgroud)
Cha*_*pat 13
git show <commit_id> | grep Author
Run Code Online (Sandbox Code Playgroud)
使用 git show + pipe + grep 工作!