Created
February 23, 2018 11:58
-
-
Save gauthamzz/99fe964edd8f2a9690d584bca538520e to your computer and use it in GitHub Desktop.
script to fetch pull request in a new branch.
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
#!/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