Last active
September 22, 2023 08:41
-
-
Save spmason/7889481 to your computer and use it in GitHub Desktop.
Checkout PRs. I'm not sure where I got this from but I can't take credit for it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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