我有一個git日誌別名,每個提交作爲一行打印。由於有些人在提交日誌中寫了太長的一行,很多提交都換行。我如何格式化git日誌輸出以剪切50個字符後的註釋?如何讓git log減少長評論?
我在git-log手冊頁中發現了這個,但它只會填充短評論,而不是長篇評論。
%<(<N>[,trunc|ltrunc|mtrunc]): make the next placeholder take at least N columns,
padding spaces on the right if necessary. Optionally truncate at the beginning (ltrunc),
the middle (mtrunc) or the end (trunc) if the output is longer than N columns. Note that
truncating only works correctly with N >= 2.
謝謝! 「trunc」部分是我正在尋找的。 –
謝謝 - 已經30分鐘試圖找出這個魔法 - 固定寬度:) – Gishu
這不適合我。我有git --version => 1.7.10.4(在Debian 7.9 Wheezy中)。從http://git-scm.com/docs/git-log/1.8.3我收集這個功能是在1.8.3中添加的(即1.8.2.2的手冊頁沒有提及它)。 – Ted