【发布时间】:2019-11-16 15:31:25
【问题描述】:
我发现默认的漂亮格式是冗长的,所以我制作了更简洁的版本:
[format]
pretty = %C(yellow)commit: %h%Creset%C(auto)%d%C(reset)%nauthor: %an <%ae>%ndate: %ad%nsummary: %s%n
产生类似的东西:
commit: ab6cdf4 (HEAD -> master, tag: v1.1)
author: author name <author@email.com>
date: Fri Nov 15 22:00:00 2019 +0100
summary: A very nice commit title
第一行的颜色和往常一样。
但是,这不仅会影响git log,还会影响git show,对于git show,我实际上更愿意使用medium 或fuller 格式。
有没有办法只为git log 设置格式?也许通过format.pretty以外的其他选项。
一个明显的解决方案是使用 other 格式为 log 或 show 的版本创建别名,但如果可能的话,我宁愿避免这样做。
【问题讨论】:
标签: git