簡體   English   中英

git shortlog:如何排除“(從提交____中挑出的櫻桃)”等等?

[英]git shortlog: how to exclude “(cherry picked from commit ____)” blah?

git shortlog可以方便地做出git shortlog的更改摘要。 但是,當我從master分支中進行Cherry-pick更改時,我使用-x標志來git cherry-pick因為它記錄了從中選擇的提交。 這會在簡短日志中造成一些丑陋:

% 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 shortlog Version-3.5.3..3.5 | sed 's/[(]cherry picked.*$//g' ,但是git似乎應該意識到自己的注釋並能夠對其進行處理,我錯過了什么?

您可以使用--pretty參數,如果您需要掃描大量日志,這將非常有用:

http://gitimmersion.com/lab_10.html

我記得過去我看到過非常豐富的資源,但現在找不到了。 無論如何,如果這還不夠,請進一步搜索。

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

當前,沒有簡單的方法可以單獨使用git shortlog做到這git shortlog

這些櫻桃挑選線被上提交消息的第二行添加,所以它們被認為是由多數的GIT中的工具提交的標題的一部分。 正如文斯(Vince)所建議的那樣,可以嘗試為短信條目提供自定義格式(使用--format選項),但是,似乎沒有這樣的漂亮格式或格式占位符僅返回主題的第一行。 (請參閱man git log

但是似乎git應該意識到它自己的注釋並能夠處理它們。 我有什么想念的嗎?

git shortlog實際上似乎只知道[PATCH]前綴( git shortlog表達式而言,正是^\\s*\\[PATCH[^]]*\\] )。

綜上所述,我認為最好的方法是保留您的sed替代品。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM