我似乎无法弄清楚如何使用 git 从提交哈希中仅打印出作者。这就是我尝试过的(并且一直试图操纵以获得我想要的)。我怎样才能使它只打印出作者,如'%n'指定的那样?
git show --pretty="format:<author>%an</author>" --name-only cf81c4a41517bdc5514d381c5309b80f5f4ca226
Run Code Online (Sandbox Code Playgroud)
你想要这样的东西:
git show -s --pretty=%an cf81c4a41517bdc5514d381c5309b80f5f4ca226
Run Code Online (Sandbox Code Playgroud)
来自git help show:
Run Code Online (Sandbox Code Playgroud)-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.