Skip to content

Instantly share code, notes, and snippets.

@weaming
Last active February 5, 2021 04:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weaming/aa46c23e20282d1fb5a4140f35d72531 to your computer and use it in GitHub Desktop.
Save weaming/aa46c23e20282d1fb5a4140f35d72531 to your computer and use it in GitHub Desktop.
使用 alias 提高 git 使用效率
alias gcl='git clone'
alias gs='git status'
alias gd='git diff'
alias gdc='git diff --cached'
alias gl='git lg'
alias gps='git push -u'
alias gconf='vi .git/config'
alias gamend='git commit --amend'
alias gamendy='git commit --amend --no-edit'
alias gback='git reset --hard HEAD~'
alias gpl='git pull && git submodule update --init'
alias gplr='git pull --rebase'
alias gplp='git pull --prune'
alias gplpr='git pull --prune --rebase'
alias gss='git show --name-status'
alias gdiff='git diff --no-index'
alias gdl='git diff HEAD~'
alias gdn='git diff --name-only'
alias ga='git add -A'
alias gm='git commit -m'
alias gma='git commit -am'
alias gmerge='git merge --no-ff'
alias gb='git branch'
alias gbc='git branch --contains'
alias gc='git checkout'
alias gra='git remote add'
alias grr='git remote rm'
alias grv='git remote -v'
alias grl='git remote get-url (git remote)'
alias grlc='grl | pbcopy'
alias gtam='git tag -a -m'
alias gtags='git tag -n99 --sort v:refname -l'
alias gf='git reflog'
alias gcp='git cherry-pick'
alias gcpf='git cherry-pick --strategy-option theirs'
alias grb='git rebase'
alias grbc='git rebase --continue'
alias grba='git rebase --abort'
alias gclean='git clean -id'
alias greset='git reset --hard'
alias git-head-hash='git log --pretty=format:"%h" --abbrev=7 -n 1'
alias git-tags-with-timestamp='git log --tags --simplify-by-decoration --pretty="format:%ci %d" | grep tag | sed "s/[(),]//g" | sed "s/tag: //g" | less'
alias gamend-with-author-weaming='git commit --no-edit --amend --author "weaming <garden.yuen@gmail.com>"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment