Skip to content

Instantly share code, notes, and snippets.

@tiste
Last active March 1, 2018 09:49
Show Gist options
  • Save tiste/18c8571c78c5426041cef7c4260037df to your computer and use it in GitHub Desktop.
Save tiste/18c8571c78c5426041cef7c4260037df to your computer and use it in GitHub Desktop.
Git aliases (from zsh)
g=git
ga='git add'
gaa='git add --all'
gb='git branch'
gba='git branch -a'
gbda='git branch --merged | command grep -vE "^(\*|\s*master\s*$)" | command xargs -n 1 git branch -d'
gbnm='git branch --no-merged'
gbr='git branch --remote'
gc='git commit -v'
'gc!'='git commit -v --amend'
gcb='git checkout -b'
gclean='git clean -fd'
gcm='git checkout master'
gcmsg='git commit -m'
'gcn!'='git commit -v --no-edit --amend'
gco='git checkout'
gd='git diff'
gdca='git diff --cached'
gf='git fetch'
ggpush='git push origin $(git_current_branch)'
glo='git log --oneline --decorate'
glog='git log --oneline --decorate --graph'
gloga='git log --oneline --decorate --graph --all'
glol='git log --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit'
gm='git merge'
gss='git status -s'
gst='git status'
gsta='git stash save'
gstd='git stash drop'
gstl='git stash list'
gstp='git stash pop'
gsts='git stash show --text'
gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
gup='git pull --rebase'
gwch='git whatchanged -p --abbrev-commit --pretty=medium'
gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"'

gbda: locally delete all merged branches

gcn!: rewrite last commit without new commit message

gunwip: remove last wip commit

gwch: kind of git diff

gwip: add a wip commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment