Created
September 2, 2017 03:12
-
-
Save BerkeleyTrue/8fab9ed9442166c1c6fda59dd3198fdf to your computer and use it in GitHub Desktop.
Checkout remote pull request
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
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