2012-08-10 133 views
0

git shortlog便於對變化進行人類可讀的總結。但是,當我從主分支選擇更改時,我使用-x標誌到git cherry-pick,因爲它記錄了從哪個提交中選取的。這導致了一些shortlog醜陋:git shortlog:如何排除「(從提交____挑選的櫻桃)」等等?

% git shortlog Version-3.5.3..3.5 

Dan S (5): 
    Fix typo that causes build fail on big-endian archs, thanks Felipe Sateler  (cherry picked from commit 4588258193072cd2fb845f7fb0b4670d6ad5edf2) 
    fix build on ARM (where qreal==float); thanks Felipe Sateler  (cherry picked from commit 976d560060185c1e31c9f40660172f0054a4a05c) 
    Strip gremlin characters from JITLib wrapForNodeProxy.sc  (cherry picked from commit d0842acae77a90b5eb9811d947ee2dad2282edff) 
    choose clipping rather than wraparound for writing integer-format audio  files (libsndfile setting) 
    arm build fix: another double->qreal in QcMultiSlider  (cherry picked from commit 548ad319dddf53e4edac1cfa44b3193027eefda2) 

有沒有一種簡單的方法來告訴git shortlog,我們不希望這些摘櫻桃線(這是新線路中的實際日誌)?

當然,我知道可以將它們過濾掉,例如使用git shortlog Version-3.5.3..3.5 | sed 's/[(]cherry picked.*$//g'。但似乎git應該意識到自己的註釋並能夠處理它們。我錯過了什麼?

回答

0

有沒有一種簡單的方法來告訴我們不希望這些 摘櫻桃線(這是新線路中的實際日誌)混帳shortlog?

目前,沒有簡單的方法可以單獨使用git shortlog

這些櫻桃挑選行被添加到提交消息的第二行,因此它們被認爲是大部分git工具提交標題的一部分。正如Vince建議的那樣,可以嘗試爲短日誌條目提供自定義格式(使用--format選項),但是,似乎沒有隻返回主題第一行的漂亮格式或格式佔位符。 (見man git log

但似乎混帳應該知道自己的註解,並 能夠對付他們。我錯過了什麼?

git shortlog實際上似乎也意識到只有[PATCH]前綴(準確地說,在正則表達式方面:^\s*\[PATCH[^]]*\])。

綜上所述,我認爲最好的做法是繼續使用sed替代品。

0

可以使用--pretty的說法,這是非常有用的,如果您需要掃描大量的日誌:

http://gitimmersion.com/lab_10.html

我記得我過去,但我看到了一個非常廣泛的資源吧無法再找到它了。無論如何,如果這個還不夠,請進一步搜索。