Skip to content

Instantly share code, notes, and snippets.

Created Dec 10, 2013
What would you like to do?
Checkout PRs. I'm not sure where I got this from but I can't take credit for it
# Checks out a PR to a pr/<number> local branch
# Usage: git pr <number> [<upstream>]
git config --global '!git fetch -fu ${2:-upstream} refs/pull/$1/head:pr/$1 && git checkout pr/$1 && :'
# Deletes pr/<number> branches
# Usage: git pr-clean
git config --global '!git for-each-ref refs/heads/pr/* --format='"'"'%(refname)'"'"' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment