Skip to content

Instantly share code, notes, and snippets.

@mattvanhorn
Created April 28, 2014 19:13
Show Gist options
  • Save mattvanhorn/11381343 to your computer and use it in GitHub Desktop.
Save mattvanhorn/11381343 to your computer and use it in GitHub Desktop.
My Git Aliases
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
st = status
co = checkout
cob = checkout -b
a = add
aa= !git add -u && git add . && git status
commit = commit -v
c = commit -m
ci = commit
ca = commit --amend -C HEAD
cs = commit -s
cp = cherry-pick
wip = !"git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit --no-verify -m \"wip\""
unwip = !"git log -n 1 | grep -q -c wip && git reset HEAD~1"
cleanup = !git remote prune origin && git gc && git clean -dfx && git stash clear
diff = diff --patience
difference = diff
up = !git fetch origin && git rebase origin/master
ir = !git rebase -i origin/master
rmb = !sh -c 'git branch -D $1 && git push origin :$1' -
br = branch
rb = !"git wip;git rebase -i origin/master;git unwip"
pr = !"git fetch;git wip;git rebase --stat origin;git unwip;git heads"
head = !"headgit log -n1"
heads = !"git log origin/master.. --format='%Cred%h%Creset;%C(yellow)%an%Creset;%H;%Cblue%f%Creset' | git name-rev --stdin --always --name-only | column -t -s';'"
lost = !"git fsck | awk '/dangling commit/ {print $3}' | git show --format='SHA1: %C(yellow)%h%Creset %f' --stdin | awk '/SHA1/ {sub(\"SHA1: \", \"\"); print}'"
whatadded = lostg --diff-filter=A
who = shortlog -n -s --no-merges
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment