Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dan-turner/858981e3010012795fba7ccc8fd383f1 to your computer and use it in GitHub Desktop.
Save dan-turner/858981e3010012795fba7ccc8fd383f1 to your computer and use it in GitHub Desktop.
Git Aliases
[alias]
co = checkout
promote = !$ZSH/bin/git-promote
wtf = !$ZSH/bin/git-wtf
rank-contributors = !$ZSH/bin/git-rank-contributors
count = !git shortlog -sn
st = status
ci = commit
br = branch
co = checkout
cod = checkout develop
com = checkout master
fe = fetch --all
bn = !git for-each-ref --format='%(refname:short)' `git symbolic-ref HEAD`
rb = rebase
rbm = rebase master
rbu = !sh -c 'BRANCH=$(git bn) && git rb upstream/$BRANCH'
rbum = rebase upstream/master
pr = !sh -c 'BRANCH=$(git bn) && git co $0 && git fe && git merge --ff-only origin/$0 && git co $BRANCH && git rb $0'
prm = !git pr master
df = diff
who = shortlog -s --
hr = reset --hard
undo = reset --soft HEAD~1
hro = !sh -c 'BRANCH=$(git bn) && git hr origin/$BRANCH'
hru = !sh -c 'BRANCH=$(git bn) && git hr upstream/$BRANCH'
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
upstream = !sh -c 'BRANCH=$(git bn) && git rev-parse --abbrev-ref $BRANCH@{upstream}'
q = !sh -c 'BRANCH=$(git bn) && UPSTREAM=$(git upstream) && git lg $UPSTREAM..$BRANCH'
new = !sh -c 'BRANCH=$(git bn) && UPSTREAM=$(git upstream) && git lg $BRANCH..$UPSTREAM'
rbc = rebase --continue
mt = mergetool
unstage = reset HEAD $1
stage = add -A
ff = !sh -c 'UPSTREAM=$(git upstream) && git merge --ff-only $UPSTREAM'
nuke = !git clean -dxf && git checkout -f
configpr = !sh -c 'git config --local --add remote.upstream.fetch +refs/pull-requests/*:refs/remotes/upstream/pull-requests/*'
copr = !sh -c 'git fetch upstream pull-requests/$0/from && git checkout pull-requests/$0/from'
ex = !\"C:/Program Files (x86)/GitExtensions/GitExtensions.exe\" browse %CD% &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment