git别名定义

发布时间 2023-09-02 11:43:28作者: 老铁来了啊

系统配置定义

window 用户可以修改~/.bashrc~/.bash_profile文件。
或者修改D:\ProgramFiles\PortableGit\etc\profile.d\aliases.sh

mac/linux修改~/.zshrc文件中定义常用的别名指令,需要首先安装zsh命令行扩展

在最后一行追加

# ----------------------
# Git Command Aliases
# ----------------------
alias gs="git status"
alias gc="git commit -m "
alias gl="git log --graph --pretty=format:'%Cred%h%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"

命令行直接使用 gs 即可以实现 git status 一样的效果了。