【发布时间】:2017-03-21 15:26:38
【问题描述】:
可用的内置漂亮格式并不完全符合我的需要(或我的口味):
https://git-scm.com/docs/pretty-formats
git log --decorate --graph --all --pretty=short 几乎是我想要的,但我也希望显示提交日期...
git log --decorate --graph --all --pretty=medium 很好,但我不想完整的提交消息。我只想显示提交消息的第一行...
所以我尝试定义自己的漂亮格式,就像 'medium' 但没有完整的提交消息,如下所示:
git log --decorate --graph --all --pretty=format:'commit %H%nAuthor: %an%nDate: %ad%n%n%s%n'
一个问题是分支名称不再显示。另一个问题是原木不再有颜色了。我怎样才能正确地做到这一点?
理想情况下,我只想覆盖 --pretty=medium,这样它就不会显示完整的提交消息,而只会显示提交的标题(或覆盖 --pretty=short 显示日期)。这是唯一可能的(覆盖一种内置的漂亮格式)吗?如果是,怎么做?
【问题讨论】: