# curl sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" # or wget sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
alias gb='git branch' alias gba='git branch -a' alias gbd='git branch -d' alias gbD='git branch -D'
alias gc='git commit' alias gcm='git commit -m' alias gc!='git commit --amend' # alias gcam='git commit -a -m' # alias gcsm='git commit -s -m'
alias gco='git checkout' alias gcob='git checkout -b'
alias gcf='git config --list' # alias gcl='git clone --recurse-submodules' # alias gclean='git clean -id' # alias gpristine='git reset --hard && git clean -dfx'
alias gf='git fetch' alias gfap='git fetch --all --prune'
alias ggpull='git pull origin "$(git_current_branch)"' alias ggpush='git push origin "$(git_current_branch)"'
alias gh='git help'
alias gl='git pull' # alias glr='git pull --rebase' # alias glrv='git pull --rebase -v' # alias glra='git pull --rebase --autostash' # alias glrav='git pull --rebase --autostash -v' # alias glum='git pull upstream master'
alias gm='git merge' # alias gmom='git merge origin/master' # alias gmt='git mergetool --no-prompt' # alias gmtvim='git mergetool --no-prompt --tool=vimdiff' # alias gmum='git merge upstream/master' # alias gma='git merge --abort'
alias gp='git push'
alias gr='git remote' alias grv='git remote -v' alias gra='git remote add' alias grmv='git remote rename' alias grrm='git remote remove' alias grset='git remote set-url' # alias grb='git rebase' # alias grba='git rebase --abort' # alias grbc='git rebase --continue' # alias grbd='git rebase develop' # alias grbi='git rebase -i' # alias grbm='git rebase master' # alias grbs='git rebase --skip' # alias grev='git revert' # alias grh='git reset' # alias grhh='git reset --hard' # alias groh='git reset origin/$(git_current_branch) --hard' # alias grm='git rm' # alias grmc='git rm --cached' # alias grs='git restore' # alias grss='git restore --source' # alias grt='cd "$(git rev-parse --show-toplevel || echo .)"' # alias gru='git reset --' # alias grup='git remote update' # alias grv='git remote -v'
alias gs='git status'
alias gst='git stash' # alias gstaa='git stash apply' # alias gstc='git stash clear' # alias gstd='git stash drop' # alias gstl='git stash list' # alias gstp='git stash pop' # alias gsts='git stash show --text' # alias gstall='git stash --all' # alias gsu='git submodule update' # alias gsw='git switch' # alias gswc='git switch -c'
alias gt='git tag' # alias gts='git tag -s' # alias gtv='git tag | sort -V'
3. 自定义方法
1 2 3 4 5 6 7 8 9
# Pretty log messages function _git_log_prettily(){ if ! [ -z $1 ]; then git log --pretty=$1 fi } compdef _git _git_log_prettily=git-log