Created
September 6, 2019 13:38
-
-
Save jonespm/96d65de72eb2f12ee9366c609d0397ae to your computer and use it in GitHub Desktop.
Git alias to checkout someone elses PR
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
gitpr() { | |
GIT=`which -p git` | |
if [ "$1" ]; then | |
if [ "$2" ]; then | |
command $GIT fetch upstream pull/$1/head:$2 | |
command $GIT checkout $2 | |
else | |
echo "You need to specify two parameters, gitpr <PR #> <BRANCHNAME>" | |
fi | |
else | |
echo "You need to specify two parameters, gitpr <PR #> <BRANCHNAME>" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment