Skip to content

Instantly share code, notes, and snippets.

@wfarr
Created November 19, 2013 01:40
Show Gist options
  • Save wfarr/7538767 to your computer and use it in GitHub Desktop.
Save wfarr/7538767 to your computer and use it in GitHub Desktop.
Handy git aliases
[alias]
up = "!sh -c 'git fetch origin; if ! git diff --exit-code origin/$(git rev-parse --abbrev-ref HEAD) >/dev/null || ! git diff --exit-code HEAD...origin/master >/dev/null; then git rebase origin/$(git rev-parse --abbrev-ref HEAD) && git merge --no-edit origin/master && git log --pretty=format:\"%Cred%ae %Creset- %C(yellow)%s %Creset(%ar)\" HEAD@{1}..; else echo \"$(git rev-parse --abbrev-ref HEAD) already up-to-date\"; fi'"
go = "!sh -c 'if git rev-parse --abbrev-ref $1 >/dev/null 2>/dev/null; then git checkout $1; else git checkout -t -b $1; fi' -"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment