我正在使用以下自定义日志格式来查看我的提交:
命令:git log --pretty=format:"%C(auto)%h %<(8,trunc)%aN %Cgreen%s %+b"
3758d35 Daniel This commit does nothing
You really should remove it before commiting.
1. This is a line
2. This is another line
a191c2b Daniel Viral helvetica lomo, typewriter fashion axe
814a6a9 John Umami pork belly pickled, fanny pack yr keffiyeh fap YOLO
d5e130e Daniel Cardigan raw denim banjo
f7107d8 Daniel 90's ramps pinterest, craft beer blue bottle
除了我希望提交主体与提交标题一致之外,它的效果很好。是否有可能只使用git?
答案 0 :(得分:5)
您可以在邮件正文前使用%w(<your max line width>,<first line indent>,<second line indent>)
,例如
%w(64,16,16)%b
来自pretty format documentation:
'%w([<w>[,<i1>[,<i2>]]])': switch line wrapping, like the -w option of git-shortlog[1].
来自shortlog:
-w[<width>[,<indent1>[,<indent2>]]]
通过将每条线包裹在宽度处来线性输出输出。每个条目的第一行用indent1空格缩进,第二行和后续行用indent2空格缩进。 width,indent1和indent2分别默认为76,6和9。
如果width为0(零),则在不包装它们的情况下缩进输出行。
不能说如何删除尾随换行符,但我想可能有一些额外的格式说明符。有一些选项可以从占位符中删除前面的换行符,但是对于尾随换行符没有类似的选项。