Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 20 lines (19 sloc) 599 Bytes
# stop if not on master branch of local git repo
git branch | awk '$1~/\*/{if($2~/master/){exit 0}else{exit 1}}'
if [[ $? -ne 0 ]] ; then
echo "STOP: not on master branch of local git repo"
exit 1
# check manditory command-line argument, which is the pull request number
if [[ "$#" -ne 1 ]]; then
echo "ERROR: must specify exactly one command-line argument,"
echo " the pull request number, NUM"
exit 1
# create local branch containing upstream pull request with NUM
git fetch upstream pull/$NUM/head:pr-$NUM
git checkout pr-$NUM
git status
exit 0