Create a gist now

Instantly share code, notes, and snippets.

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 alias.pr '!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 alias.pr-clean '!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