2014-06-27 51 views
0

我似乎無法弄清楚如何僅使用git從提交散列中打印出作者。這就是我所嘗試過的(並且一直試圖去操縱我想要的東西)。我怎樣才能讓它只打印出作者,如'%n'所指定的?Git只顯示提交散列的作者?

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

回答

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.