git别名定义
系统配置定义
window 用户可以修改~/.bashrc
或~/.bash_profile
文件。
或者修改D:\ProgramFiles\PortableGit\etc\profile.d\aliases.sh
mac/linux
修改~/.zshrc
文件中定义常用的别名指令,需要首先安装zsh
命令行扩展
在最后一行追加
# ----------------------
# Git Command Aliases
# ----------------------
alias gs="git status"
alias gd="git diff"
alias gc="git commit -m "
alias gl="git log --graph --date=format:'%Y-%m-%d %H:%M:%S' --pretty=format:'%Cred%h%Creset %C(cyan)%cd%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias gb="git branch"
alias ga="git add -A"
alias go="git checkout"
alias gp="git push;git push github"
alias gcl="git config --local"
alias gcp="git cherry-pick"
alias catas="cat /etc/profile.d/aliases.sh"
gtg() {
git tag -a "$1" -m "$2"
}
gptg() {
git push origin --tags
}
命令行直接使用 gl 即可以实现 输出git历史 一样的效果了。