带附加信息的Git日志装饰图

时间:2013-12-18 16:21:46

标签: git

git log命令,

git log --graph --decorate --pretty=oneline --abbrev-commit

enter image description here

显示我真的很喜欢图。 请注意,上面的git命令将自动漂亮的颜色应用于“(refs / heads /,refs / tags /和refs / remotes /)”部分。

我希望我可以附加现有的格式:

*<abbrevated commit> (refs/heads/, refs/tags/ and refs/remotes/) <commit message>

追加到最后

<relative date> <Vorname nachname>

终于看起来像

*<abbrevated commit> (refs/heads/, refs/tags/ and refs/remotes/)* <commit message> <relative date> <Vorname nachname>

我尝试了命令:

git log --graph\n--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\n--abbrev-commit --date=relative

enter image description here 这给了我相同的内容,但现在自动颜色不适用于%d参数。现在,如果我不用黄色强制,则应用“重置”颜色。

简单中我想要如下(编辑图像以显示演示) enter image description here 请提出你的建议。

1 个答案:

答案 0 :(得分:6)

像这样包裹%d

%C(auto)%d%Creset

获得自动装饰着色。

自动着色取决于git版本&gt; = 1.8.3:http://git.kernel.org/cgit/git/git.git/tree/Documentation/RelNotes/1.8.3.txt#n72

相关问题