引言
git
别名归纳
别名列表
查看状态:git st
配置命令:
git config --global alias.st status
别名代码:
git st
以上简易代码,与下面代码等价(要先执行上面的配置命令):
git status
提交版本:git ci
配置命令:
git config --global alias.ci 'commit'
别名代码:
git ci -m "提交内容"
以上简易代码,与下面代码等价(要先执行上面的配置命令):
git commit -m "提交内容"
### 回退版本:`git unstage`
配置命令:
git config --global alias.unstage 'reset HEAD'
别名代码:
git unstage test.py
以上简易代码,与下面代码等价(要先执行上面的配置命令):
git reset HEAD test.py
### 最近提交:`git last`
显示最近一次提交的信息,并且展示`GPG`签名结果(如果有)
配置命令:
git config --global alias.last 'log -1 --show-signature'
别名代码:
git last
以上简易代码,与下面代码等价(要先执行上面的配置命令):
git log -1 --show-signature
### 格式日志:`git lg`

配置命令:
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
别名代码:
git lg
以上简易代码,与下面代码等价(要先执行上面的配置命令):
git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
### 格式日志:`git plog`

配置命令:
git config --global alias.plog "log --graph --date=format:'%Y-%m-%d %H:%M:%S %A' --pretty=format:'%C(bold blue)commit: %C(bold red)%h %C(#00A89A)%d %n%C(bold blue)parent commit: %C(bold red)%p %n%C(bold blue)title: %C(#A477DB)%s %n%C(bold blue)content: %C(#A477DB)%b %n%C(bold blue)author: %C(#1B92D6)%an <%ae> %n%C(bold blue)date: %C(#1B92D6)%ad %C(#4EAB00)(%ar) %n%n'"
别名代码:
git plog
以上简易代码,与下面代码等价(要先执行上面的配置命令):
git log --graph --date=format:'%Y-%m-%d %H:%M:%S %A' --pretty=format:'%C(bold blue)commit: %C(bold red)%h %C(#00A89A)%d %n%C(bold blue)parent commit: %C(bold red)%p %n%C(bold blue)title: %C(#A477DB)%s %n%C(bold blue)content: %C(#A477DB)%b %n%C(bold blue)author: %C(#1B92D6)%an <%ae> %n%C(bold blue)date: %C(#1B92D6)%ad %C(#4EAB00)(%ar) %n%n'