Created
April 23, 2020 08:52
-
-
Save willcl-ark/77512bac7facae3d351f6d7d46efef37 to your computer and use it in GitHub Desktop.
git aliases to checkout and remove PRs easily
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
# Add this section to your global ~/.gitconfig file | |
[alias] | |
pr = "!f() { git fetch -fu ${2:-$(git remote |grep ^upstream || echo origin)} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f" | |
pr-clean = "!git for-each-ref refs/heads/pr/* --format=\"%(refname)\" | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done" | |
spr = "!f() { git fetch -fu ${2:-$(git remote |grep ^upstream || echo origin)} refs/pull-requests/$1/from:pr/$1 && git checkout pr/$1; }; f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment