Skip to content

Instantly share code, notes, and snippets.

@gauthamzz
Created February 23, 2018 11:58
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 gauthamzz/99fe964edd8f2a9690d584bca538520e to your computer and use it in GitHub Desktop.
Save gauthamzz/99fe964edd8f2a9690d584bca538520e to your computer and use it in GitHub Desktop.
script to fetch pull request in a new branch.
#!/bin/bash
if [ "$1" == "--help" ]; then
printf "Usage: fetch-pull-request [--help] pull_request_id [remote=upstream] \n\n Locally fetch a pull request and test it. \n Remote is set to upstream by default.\n"
exit 1
elif [ $# -eq 0 ]; then
echo "Pull request id not given."
exit 1
else
set -e -x
remote=${2:-upstream}
git fetch $remote pull/$1/head:review-$1
git checkout review-$1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment