Skip to content

Instantly share code, notes, and snippets.

@BerkeleyTrue
Created September 2, 2017 03:12
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 BerkeleyTrue/8fab9ed9442166c1c6fda59dd3198fdf to your computer and use it in GitHub Desktop.
Save BerkeleyTrue/8fab9ed9442166c1c6fda59dd3198fdf to your computer and use it in GitHub Desktop.
Checkout remote pull request
gcorpullrequest() {
# gcorpullrequest 123 upstream
# gcorpullrequest 124
remote=origin
echo "What do you want to call the local branch?"
read branchname
if [ $# = 2 ]; then
remote=$2
fi
echo "fetching PR #$1 from $remote"
echo "Do you want to continue?"
select yn in "Yes" "No"; do
case $yn in
Yes ) break;;
No ) return 0;;
esac
done
git fetch $remote pull/$1/head:$branchname
git checkout $branchname
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment