我有一个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