Skip to content

Instantly share code, notes, and snippets.

@jonespm
Created September 6, 2019 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonespm/96d65de72eb2f12ee9366c609d0397ae to your computer and use it in GitHub Desktop.
Save jonespm/96d65de72eb2f12ee9366c609d0397ae to your computer and use it in GitHub Desktop.
Git alias to checkout someone elses PR
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