git log 查看分支图

操作:

在git config文件里面设置别名。

版本1:
git config --global alias.lg "log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"


版本2:(颜色更好一点吧,我改过的)
git config --global alias.lg "log --graph --all --pretty=format:'%C(yellow)%h%C(reset) -%C(bold red)%d%C(reset) %s %C(green)(%cr) %C(bold blue)<%an>%C(reset)' --abbrev-commit --date=relative"

版本3:(基于2修改的,因为commit 太长了,限制了commit的最大长度 65个字符)
git config --global alias.lg "log --graph --all --pretty=format:'%C(yellow)%h%C(reset) -%C(bold red)%d%C(reset) %<(65,trunc)%s %C(green)(%cr) %C(bold blue)<%an>%C(reset)' --abbrev-commit --date=relative"

 

git config 更多参数修改,参考如下:

https://git-scm.com/book/zh/v2/Git-%E5%9F%BA%E7%A1%80-%E6%9F%A5%E7%9C%8B%E6%8F%90%E4%BA%A4%E5%8E%86%E5%8F%B2

 

然后通过命令

git lg

来列出分支图 ,(下面的图是版本1的)

 

引用:

https://blog.csdn.net/alexwang1983/article/details/18742751

 

posted @ 2023-04-12 15:17  年华似水゛  阅读(606)  评论(0编辑  收藏  举报