我在自己的机器上单独使用Git,我发现很难维护所有分支和提交的心理模型。我知道我可以通过git日志查看提交历史,但是有没有一种方法可以查看整个分支地形,就像这些ASCII映射一样,似乎到处都在用它来解释分支?

      .-A---M---N---O---P
     /     /   /   /   /
    I     B   C   D   E
     \   /   /   /   /
      `-------------'

感觉就像有人来找我的存储库时,很难弄清楚到底发生了什么。

我猜我是受到了AccuRev的流媒体浏览器的影响…


使用git log——graph或gitk。(两者都接受——all,这将显示所有分支,而不仅仅是当前的分支。)

对于分支名称和紧凑视图,尝试:

git log --graph --decorate --oneline

我通常用

git log --graph --full-history --all --pretty=format:"%h%x09%d%x20%s"

使用颜色(如果你的shell是Bash):

git log --graph --full-history --all --color \
        --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s"

这将像这样打印基于文本的表示:

* 040cc7c       (HEAD, master) Manual is NOT built by default
* a29ceb7       Removed offensive binary file that was compiled on my machine and was hence incompatible with other machines.
| * 901c7dd     (cvc3) cvc3 now configured before building
| * d9e8b5e     More sane Yices SMT solver caller
| | * 5b98a10   (nullvars) All uninitialized variables get zero inits
| |/
| * 1cad874     CFLAGS for cvc3 to work successfully
| *   1579581   Merge branch 'llvm-inv' into cvc3
| |\
| | * a9a246b   nostaticalias option
| | * 73b91cc   Comment about aliases.
| | * 001b20a   Prints number of iteration and node.
| |/
|/|
| * 39d2638     Included header files to cvc3 sources
| * 266023b     Added cvc3 to blast infrastructure.
| * ac9eb10     Initial sources of cvc3-1.5
|/
* d642f88       Option -aliasstat, by default stats are suppressed

(你可以只使用git log——format=oneline,但它会将提交消息绑定到数字,这看起来不太漂亮)。

要为该命令创建快捷方式,您可能需要编辑~/。gitconfig文件:

[alias]
  gr = log --graph --full-history --all --color --pretty=tformat:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s%x20%x1b[33m(%an)%x1b[0m"

然而,正如Sodel the Vociferous在评论中指出的那样,这么长的格式化命令很难记住。通常,这不是问题,因为你可以把它放在~/。gitconfig文件。然而,如果你有时不得不登录到远程机器,而你不能修改配置文件,你可以使用一个更简单但更快的输入版本:

git log --graph --oneline

我喜欢,用git日志,做:

 git log --graph --oneline --branches

(还有——all,用于查看远程分支)

与最新Git版本的配合:自1.6.3以来引入(2009年5月7日星期四)

“——pretty=<style>”选项到命令日志族现在可以拼写为“——format=<style>”。 此外,——format=%formatstring是——pretty=tformat:%formatstring的简写。 "——oneline"是"——pretty=oneline -abbrev-commit"的同义词。

PS D:\git\tests\finalRepo> git log --graph --oneline --branches --all
* 4919b68 a second bug10 fix
* 3469e13 a first bug10 fix
* dbcc7aa a first legacy evolution
| * 55aac85 another main evol
| | * 47e6ee1 a second bug10 fix
| | * 8183707 a first bug10 fix
| |/
| * e727105 a second evol for 2.0
| * 473d44e a main evol
|/
* b68c1f5 first evol, for making 1.0

你也可以限制日志显示的跨度(提交的数量):

PS D:\git\tests\finalRepo> git log --graph --oneline --branches --all -5
* 4919b68 a second bug10 fix
* 3469e13 a first bug10 fix
* dbcc7aa a first legacy evolution
| * 55aac85 another main evol
| | * 47e6ee1 a second bug10 fix

(只显示最后5次提交)


我不喜欢当前选择的解决方案是:

 git log --graph

它显示了太多的信息(当我只想看一个快速的摘要):

PS D:\git\tests\finalRepo> git log --graph
* commit 4919b681db93df82ead7ba6190eca6a49a9d82e7
| Author: VonC <vonc@laposte.net>
| Date:   Sat Nov 14 13:42:20 2009 +0100
|
|     a second bug10 fix
|
* commit 3469e13f8d0fadeac5fcb6f388aca69497fd08a9
| Author: VonC <vonc@laposte.net>
| Date:   Sat Nov 14 13:41:50 2009 +0100
|
|     a first bug10 fix
|

Gitk很棒,但迫使我离开shell会话到另一个窗口,而快速显示最后n次提交通常就足够了。


如果你使用的是OS X系统,Gitx也是一个很棒的可视化工具。


对于Linux来说,Gitg是一个很棒的工具,类似于OS x的Gitx。只需在命令行上从存储库的树结构中某处运行' Gitg '(与Gitx相同)。


对于任何这些方法(基于git log或gitk),您都可以添加——simplify-by-decoration来折叠历史记录中无趣的线性部分。这使得一次可以看到更多的拓扑结构。我现在可以理解大量的历史,如果没有这个选项就无法理解!

我觉得有必要发布这篇文章,因为它似乎并没有像它应该的那样出名。在Stack Overflow的大多数关于可视化历史的问题中,它都没有出现,而且我花了相当多的时间才找到它——即使在我知道我想要它之后!我终于在这个Debian bug报告中找到了它。Stack Overflow上首先提到的似乎是Antoine Pelisse的回答。


傻笑画的图真不错。


我99.999%的时间用gitlg来查看历史,0.001%用gitlog来查看历史。

我只是想分享两个可能有用的日志别名(从.gitconfig配置):

[Alias]
     lg = log --graph --pretty=format:'%Cred%h%Creset %ad %s %C(yellow)%d%Creset %C(bold blue)<%an>%Creset' --date=short
     hist = log --graph --full-history --all --pretty=format:'%Cred%h%Creset %ad %s %C(yellow)%d%Creset %C(bold blue)<%an>%Creset' --date=short

Git lg将看到当前的分支历史记录。 Git hist将看到整个分支历史。


看看SmartGit吧。它让我想起了TortoiseHg分支可视化,并且它是免费的非商业用途。


我使用以下别名。

[alias]
    lol = log --graph --decorate --pretty=oneline --abbrev-commit
    lola = log --graph --decorate --pretty=oneline --abbrev-commit --all

它在配色方案中比我上面看到的别名有更多的信息。它似乎也很常见,所以你可能有机会在别人的环境中存在,或者可以在对话中提到它而不需要解释。

在Git lola中有截图和完整的描述。


我个人最喜欢的别名,通过.gitconfig:

graph = log --graph --color --all --pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%x20(%ce)%n%x20%s%n"

你可以像这样直接从命令行测试:

git log --graph --color --all --pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%x20(%ce)%n%x20%s%n"

样例输出:


我发现全局图很有用。

它使用dot/Graphviz创建了漂亮的2D图形,而不是gitk和朋友生成的相当线性的“一维”视图。使用-i选项,它显示分支点和合并提交,但省略了中间的所有内容。


Gitk的输出有时让我读起来很痛苦:

这促使我编写了GitVersionTree:


一个很好的基于web的工具是ungit。它可以运行在Node.js和Git支持的任何平台上。有一个视频是关于它是如何为那些发现这类事情比阅读更容易的人工作的……


我找到了这篇博客文章,它给出了一个简洁的方法:

git log --oneline --abbrev-commit --all --graph --decorate --color

我通常为上面的命令创建一个别名:

alias gl='git log --oneline --abbrev-commit --all --graph --decorate --color'

只需使用gl。

您还可以将别名添加到Git配置中。打开文件~/。并在[alias]部分中添加以下行:

[alias]
        lg = log --oneline --abbrev-commit --all --graph --decorate --color

像这样使用它:

git lg

样例输出:


TortoiseGit有一个叫做“修订图”的工具。如果你在Windows上,它很容易右键单击你的仓库→Tortoise Git→修订图。


看看BranchMaster。

我写它是为了可视化一个复杂的分支结构,通过将它们之间的所有提交压缩到一行。数字表示提交次数。


我已经试过了——通过装饰来简化,但我所有的合并都没有显示出来。因此,我只是删除了头部没有“\”和“/”符号的行,而始终保留带有“(”的行,表示紧接着的分支。在显示分支历史记录时,我通常对提交注释不感兴趣,所以我也删除了它们。我最终得到了下面的shell别名。

gbh () { 
    git log --graph --oneline --decorate "$@" | grep '^[^0-9a-f]*[\\/][^0-9a-f]*\( [0-9a-f]\|$\)\|^[^0-9a-f]*[0-9a-f]*\ (' | sed -e 's/).*/)/'
}

另一条git日志命令。这是一个固定宽度的列:

git log --graph --pretty=format:"%x09%h | %<(10,trunc)%cd |%<(25,trunc)%d | %s" --date=short

样例输出:


我有3个别名(为了方便使用,还有4个别名-别名),通常都放在~/中。gitconfig文件:

[alias]
    lg = lg1
    lg1 = lg1-specific --all
    lg2 = lg2-specific --all
    lg3 = lg3-specific --all

    lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
    lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
    lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n''          %C(white)%s%C(reset)%n''          %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'

gitlg / gitlg1是这样的:

Git lg2是这样的:

git lg3是这样的:

值得注意的是,这并不意味着这是一个最终的解决方案——它只是一个模板,供您根据自己的喜好进行更改、添加和修复。如果你想使用这些,我的建议是:

将它们添加到你的.gitconfig中, 根据您的喜好定制(不同的颜色选择,2线和3线版本的不同线条安排,等等), 然后将副本保存到Gist或其他代码片段工具中,以便将来可以复制并粘贴到.gitconfigs中(当然,也可以选择版本控制您的dotfiles)。

注意:答案复制并改进了stackoverflow.com/questions/1057564/pretty-git-branch-graphs上的答案,因为在这里比在那里更合适。由于历史原因,把副本留在了另一个问题上——它现在已经关闭了,答案被一堆其他答案引用了。


在Windows上,你可以使用一个非常有用的工具:Git Extensions。它是一个GUI工具,使Git操作非常简单。

而且它是开源的。


看看GitKraken——一个跨平台的GUI,它以清晰的方式显示拓扑。

这里有一个关于一些高级功能的快速视频教程。

注:需注册。


我在~/中有这个git日志别名。查看图表历史记录:

[alias]
l = log --all --graph --pretty=format:'%C(auto)%h%C(auto)%d %s %C(dim white)(%aN, %ar)'

别名设置好后,git l将显示如下内容:

在Git 2.12+中,您甚至可以使用日志自定义图形的线条颜色。graphColors配置选项。

至于日志的格式,它类似于——oneline,只是增加了作者名称(关于.mailmap)和相对作者日期。注意%C(auto)语法,它告诉Git使用默认的颜色来提交哈希,等等,在Git >= 1.8.3中是支持的。


还有Tig。它不像“BranchMaster”那样折叠树枝,但是……

它是快速的,在终端运行。

因为它是如此之快(+键盘控制),你得到一个伟大的用户体验。它几乎就像我的“ls”,用于包含Git存储库的目录。

它有常用的快捷方式,/搜索等。

(PS:这是屏幕截图背景中的终端。现在看起来好多了,但是我的电脑拒绝截屏,对不起)

(PPS:我也使用GitKraken,它有非常清晰的可视化,但它比Tig重得多)


Mac用户可以试试免费的开源工具GitUp。

我喜欢这些图表的显示方式。它比我见过的其他工具更清晰。

该项目位于GitHub。


Git的官方网站使用了一些特定于第三方平台的GUI工具。为Linux平台打开Git GUI工具。

我已经在Linux平台上使用了gitg和GitKraken。两者都有助于理解提交树。


对于那些使用VSCode文本编辑器的人,可以考虑D. Jayamanne编写的Git历史扩展:


评分最高的答案是将git日志命令显示为最喜欢的解决方案。

如果您需要类似表格的输出,比如类似列的输出,您可以使用出色的git日志命令,并对.gitconfig别名稍加修改和一些限制。下面的片段。

修改:

你必须在每次提交占位符之前使用%><(<N>[,ltrunc|mtrunc|trunc]) 添加唯一分隔符作为列分隔符 添加——颜色选项的彩色输出

限制:

you can place the CPU graph at every column as long as you do not use non-empty newlines %n... the last commit placeholder of any newline can be used without %><(<N>[,trunc]) if extra characters are needed for decoration like (committer: , < and >) in ...%C(dim white)(committer: %cn% <%ce>)%C(reset)... to get a tablelike output they must be written directly before and after the commit placeholder ...%C(dim white)%<(25,trunc)(committer: %cn%<(25,trunc) <%ce>)%C(reset)... if the --format=format: option is not the last one close it with %C(reset) as mostly done compared to normal git log output this one is slow, but nice

本网站的例子如下:

thompson1     = log --all --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'

将以^作为分隔符,而不添加字符

thompson1-new = log --all --graph --color --abbrev-commit --decorate --format=format:'^%C(bold blue)%<(7,trunc)%h%C(reset)^%C(bold green)%<(21,trunc)%ar%C(reset)^%C(white)%<(40,trunc)%s%C(reset)^%C(dim white)%<(25,trunc)%an%C(reset)^%C(auto)%d%C(reset)'

比较起来

或者将图形移动到第5列:

要实现这一点,将以下内容添加到.gitconfig文件中,并将日志别名命名为 geteable YourLogAlias:

[color "decorate"]
    HEAD = bold blink italic 196
    branch = 214
    tag = bold 222

[alias]

    # delimiter used as column seperator
    delim = ^
    # example thompson1
    thompson1     = log --all --graph         --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
    # modified thompson1 example
    thompson1-new = log --all --graph --color --abbrev-commit --decorate --format=format:'^%C(bold blue)%<(7,trunc)%h%C(reset)^%C(bold green)%<(21,trunc)%ar%C(reset)^%C(white)%<(40,trunc)%s%C(reset)^%C(dim white)%<(25,trunc)%an%C(reset)^%C(auto)%d%C(reset)'
    # set a column for the graph
    thompson1-new-col = 1

tably     = !bash -c '"                                                                                                              \
              declare -A col_length;                                                                                                 \
              delim=$(git config alias.delim);                                                                                       \
              git_log_cmd=$(git config alias.$1);                                                                                    \
              git_tre_col=${2:-$(git config alias.$1-col)};                                                                          \
                                                                                                                                     \
              i=0;                                                                                                                   \
              n=0;                                                                                                                   \
              while IFS= read -r line; do                                                                                            \
                ((n++));                                                                                                             \
                while read -d\"$delim\" -r col_info;do                                                                               \
                  ((i++));                                                                                                           \
                  [[ -z \"$col_info\" ]] && col_length[\"$n:$i\"]=${col_length[\"${last[$i]:-1}:$i\"]} && ((i--)) && continue;       \
                  [[ $i -gt ${i_max:-0} ]] && i_max=$i;                                                                              \
                  col_length[\"$n:$i\"]=$(grep -Eo \"\\([0-9]*,[lm]*trunc\\)\" <<< \"$col_info\" | grep -Eo \"[0-9]*\" | head -n 1); \
                  [[ -n \"${col_length[\"$n:$i\"]}\" ]] && last[$i]=$n;                                                              \
                  chars_extra=$(grep -Eo \"\\trunc\\).*\" <<< \"$col_info\");                                                        \
                  chars_extra=${chars_extra#trunc)};                                                                                 \
                  chars_begin=${chars_extra%%\\%*};                                                                                  \
                  chars_extra=${chars_extra#*\\%};                                                                                   \
                  case \" ad aD ae aE ai aI al aL an aN ar as at b B cd cD ce cE ci cI cl cL cn cN cr                                \
                          cs ct d D e f G? gd gD ge gE GF GG GK gn gN GP gs GS GT h H N p P s S t T \" in                            \
                   *\" ${chars_extra:0:2} \"*)                                                                                       \
                     chars_extra=${chars_extra:2};                                                                                   \
                     chars_after=${chars_extra%%\\%*};                                                                               \
                     ;;                                                                                                              \
                   *\" ${chars_extra:0:1} \"*)                                                                                       \
                     chars_extra=${chars_extra:1};                                                                                   \
                     chars_after=${chars_extra%%\\%*};                                                                               \
                     ;;                                                                                                              \
                   *)                                                                                                                \
                     echo \"No Placeholder found. Probably no tablelike output.\";                                                   \
                     continue;                                                                                                       \
                     ;;                                                                                                              \
                  esac ;                                                                                                             \
                  if [[ -n \"$chars_begin$chars_after\" ]];then                                                                      \
                    len_extra=$(echo \"$chars_begin$chars_after\" | wc -m);                                                          \
                    col_length["$n:$i"]=$((${col_length["$n:$i"]}+$len_extra-1));                                                    \
                  fi;                                                                                                                \
                                                                                                                                     \
                done <<< \"${line#*=format:}$delim\";                                                                                \
                i=1;                                                                                                                 \
              done <<< \"$(echo -e \"${git_log_cmd//\\%n/\\\\n}\")\";                                                                \
                                                                                                                                     \
              while IFS= read -r graph;do                                                                                            \
                chars_count=$(sed -nl1000 \"l\" <<< \"$graph\" | grep -Eo \"\\\\\\\\\\\\\\\\|\\||\\/|\\ |\\*|_\" | wc -l);           \
                [[ ${chars_count:-0} -gt ${col_length["1:1"]:-0} ]] && col_length["1:1"]=$chars_count;                               \
              done < <([[ -n \"$(grep -F graph <<< \"$git_log_cmd\")\" ]] && git log --all --graph --pretty=format:\" \" && echo);   \
                                                                                                                                     \
              l=0;                                                                                                                   \
              while IFS= read -r line;do                                                                                             \
                c=0;                                                                                                                 \
                ((l++));                                                                                                             \
                [[ $l -gt $n ]] && l=1;                                                                                              \
                while IFS= read -d\"$delim\" -r col_content;do                                                                       \
                  ((c++));                                                                                                           \
                  if [[ $c -eq 1 ]];then                                                                                             \
                    [[ -n \"$(grep -F \"*\" <<< \"$col_content\")\" ]] || l=2;                                                       \
                    chars=$(sed -nl1000 \"l\" <<< \"$col_content\" | grep -Eo \"\\\\\\\\\\\\\\\\|\\||\\/|\\ |\\*|_\" | wc -l);       \
                    whitespaces=$((${col_length["1:1"]}-$chars));                                                                    \
                    whitespaces=$(seq -s\" \" $whitespaces|tr -d \"[:digit:]\");                                                     \
                    col_content[1]=\"${col_content[1]}$col_content$whitespaces\n\";                                                  \
                  else                                                                                                               \
                    col_content[$c]=\"${col_content[$c]}$(printf \"%-${col_length[\"$l:$c\"]}s\" \"${col_content:-\"\"}\")\n\";      \
                  fi;                                                                                                                \
                done <<< \"$line$delim\";                                                                                            \
                for ((k=$c+1;k<=$i_max;k++));do                                                                                      \
                  empty_content=\"$(printf \"%-${col_length[\"$l:$k\"]:-${col_length[\"${last[$k]:-1}:$k\"]:-0}}s\" \"\")\";         \
                  col_content[$k]=\"${col_content[$k]}$empty_content\n\";                                                            \
                done;                                                                                                                \
              done < <(git $1 && echo);                                                                                              \
                                                                                                                                     \
              while read col_num;do                                                                                                  \
                if [[ -z \"$cont_all\" ]];then                                                                                       \
                  cont_all=${col_content[$col_num]};                                                                                 \
                else                                                                                                                 \
                  cont_all=$(paste -d\" \" <(echo -e \"$cont_all\") <(echo -e \"${col_content[$col_num]}\"));                        \
                fi;                                                                                                                  \
              done <<< $(seq 2 1 ${git_tre_col:-1};seq 1;seq $((${git_tre_col:-1}+1)) 1 $i_max);                                     \
              echo -e \"$cont_all\";                                                                                                 \
              "' "git-tably"

这或多或少只是我答案的一部分https://stackoverflow.com/a/61487052/8006273,在那里你可以找到更深入的解释,但也很适合这个问题。

如果你的git日志命令有问题,请留下评论。


我正在使用Visual Studio代码编辑器,我发现自己对mhutchie所做的Git Graph扩展非常满意。(我不是一个人,有100万用户的扩展!)

如果你碰巧喜欢这个编辑器,那么就去扩展选项卡(左边中间的格子),输入“Git Graph”并安装

要使用它,请转到Git控件选项卡并按查看Git图形按钮


我发现难以置信的是,在许多答案中,它没有提到Gitviz,可用于windows /Linux/Mac 除了提供分支和提交的2d视图外,它还侦听git命令并自行修改图形。


我想分享我的git日志命令的压缩预设: (绿色是我的默认控制台颜色)

它被设计成尽可能紧凑和像表格一样(没有增加任何多余的空间),同时仍然有信息和易于阅读。这基本上是Git默认使用的中型格式的压缩版本。

特点:

固定物品位置; 提交哈希和引用名称的默认颜色; 提交作者日期为本地时区; 提交消息被包装成128个字符并缩进; 扩展提交消息也会显示(如果有的话),并删除任何尾随换行符。


您可以使用以下命令将其添加到配置文件中: (注意他们会改变所有git日志格式的日期格式!)

$ git config --global log.date 'format-local:%d %b %Y %H:%M'
$ git config --global pretty.compact '%C(auto)%h %C(cyan)%<(17,trunc)%an%C(auto) %D%n        %C(cyan)%ad%C(auto) %w(128,0,26)%s%w(0,0,26)%+b%-(trailers:key=FAKE)'

... 然后像这样使用它(使用——graph,——all或任何其他选项):

$ git log --graph --pretty=compact

如果你也想让它默认,你可以用这个命令:

$ git config --global format.pretty compact

或者如果你喜欢别名:

$ git config --global alias.logc "log --date=format-local:'%d %b %Y %H:%M' --pretty='%C(auto)%h %C(cyan)%<(17,trunc)%an%C(auto) %D%n        %C(cyan)%ad%C(auto) %w(128,0,26)%s%w(0,0,26)%+b%-(trailers:key=FAKE)'"

如果您想做任何更改,请参阅git日志参考的PRETTY FORMATS部分。


对于那些在VIM工作的人,请参阅gv。Vim可能很有趣。这是我直接从VIM中使用的,还可以方便地浏览提交历史记录并检查特定的更改。

这是来自全球之声的截图。vim的Github页面:

具体的风格取决于所使用的颜色主题。


Git内置的工具(没有附加组件)具有日期时间格式

现有的答案都没有显示如何使用内置的git日志工具更改日期-时间格式。由于文档对这个特性有点迟钝,我添加了两个别名作为示例。

git树-所有提交的时间戳日志

# Tools for analyzing the merge history of a repo using tree-like graphics
[alias]
    tree = log --no-show-signature --graph --date=format-local:%H:%M:%S --all \
        --pretty="'%C(#ffe97b ul)%h%C(reset) %C(#568ea6)%cs %C(#305f72)%cd%C(reset)%C(auto)%d%C(reset) %s %C(yellow)(%C(reset)%C(#1abc9c)%an%C(reset)%C(yellow),%C(reset) %C(#007055)%cr%C(reset)%C(yellow))%C(reset)'"

git树。分支——所有分支/标签提交的时间戳日志

# Some refinements to normal 'git tree' output for alternative perspectives.
[alias "tree"]
    branches = tree --simplify-by-decoration

颜色代码

Spec Color Style
Commit ID Yellow Underline
Commit date Dark Blue
Commit time Light Blue
Commit message White
Commit Author Green
Commit relative date Dark Green
Remote branches Red
Local branches Purple
Tags Pink Underline