前言
- 一般在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: