我似乎无法弄清楚如何使用git从提交哈希中仅打印出作者。这就是我所尝试过的(并试图操纵以获得我想要的东西)。我如何制作它以便只打印出作者,按照'%n'?
指定git show --pretty="format:<author>%an</author>" --name-only cf81c4a41517bdc5514d381c5309b80f5f4ca226
答案 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.