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

Ara*_*ane 3 git

那么git log命令,

git log --graph --decorate --pretty=oneline --abbrev-commit
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

向我展示了真正的图形.请注意,上面的git命令将自动漂亮的颜色应用于"(refs/heads /,refs/tags /和refs/remotes /)"部分.

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

*<abbrevated commit> (refs/heads/, refs/tags/ and refs/remotes/) <commit message>
Run Code Online (Sandbox Code Playgroud)

追加到底

<relative date> <Vorname nachname>
Run Code Online (Sandbox Code Playgroud)

终于看起来像了

*<abbrevated commit> (refs/heads/, refs/tags/ and refs/remotes/)* <commit message> <relative date> <Vorname nachname>
Run Code Online (Sandbox Code Playgroud)

我试过这个命令:

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
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述 这给了我相同的内容,但现在自动颜色不适用于%d参数.现在,如果我不用黄色强制,则应用"重置"颜色.

在简单我想如下(编辑图像显示演示) 在此输入图像描述 请提出你的建议.

jes*_*ssh 6

换行%d如下:

%C(auto)%d%Creset
Run Code Online (Sandbox Code Playgroud)

获得自动装饰着色.

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

  • 好的发现,auto只能来自git Version:git 1.8.3 (3认同)