【git】git配置自带的查看分支log图

前言

  • 一般在gitlab等仓库里可以看见分支图,其实git上也有这个功能,只要配置别名快速调用就可以了。

git配置

  • 首先你需要找到git配置文件。
  • windows的git配置文件一般在用户目录下自己登陆名字的文件夹里有个.gitconfig文件。
  • mac的git配置文件在~/.gitconfig里。
  • 编辑文件复制以下alias:
[alias]
    lg1 = log --graph --abbrev-commit --decorate --date=relative --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(bold yellow)%d%C(reset)' --all
    lg2 = 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 yellow)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' -10 --all

配置效果

  • 配置前的git log:
    在这里插入图片描述
  • 配置后git log:
    在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/yehuozhili/article/details/128012267