git别名

创建别名

[root@localhost apeng]# git config --global alias.ci commit
[root@localhost apeng]# git config --global alias.fz branch
[root@localhost apeng]# git config --global alias.sw checkout

查看别名

[root@localhost apeng]# git config --list |grep alias
alias.ci=commit
alias.fz=branch
alias.sw=checkout

将别名加入到这个文件中/root/.gitconfig

[root@localhost apeng]# vim /root/.gitconfig
[user]
        name = apeng
        email = apeng@apenglinux.com
[alias]
        ci = commit
        fz = branch
        sw = checkout

给日志作一个别名

[root@localhost apeng]# 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"

取消别名

[root@localhost apeng]# git config --unset alias.ci