Git只显示提交哈希的作者?

时间:2014-06-27 21:08:13

标签: git

我似乎无法弄清楚如何使用git从提交哈希中仅打印出作者。这就是我所尝试过的(并试图操纵以获得我想要的东西)。我如何制作它以便只打印出作者,按照'%n'?

指定
git show --pretty="format:<author>%an</author>"  --name-only cf81c4a41517bdc5514d381c5309b80f5f4ca226

1 个答案:

答案 0 :(得分:2)

你想要这样的东西:

git show -s --pretty=%an cf81c4a41517bdc5514d381c5309b80f5f4ca226

来自git help show

   -s, --no-patch
       Suppress diff output. Useful for commands like git show that show the
       patch by default, or to cancel the effect of --patch.