Skip to content

Instantly share code, notes, and snippets.

@BerkeleyTrue
Forked from vojtajina/fetch-git-pr.bash
Created October 9, 2015 07:58
Show Gist options
  • Save BerkeleyTrue/23efb98d2d932f3708d3 to your computer and use it in GitHub Desktop.
Save BerkeleyTrue/23efb98d2d932f3708d3 to your computer and use it in GitHub Desktop.
Bash script for fetching a pull request from github...
# fetching a single pull request from github
# put it into ~/.profile or ~/.bashrc
function fetch_pr() {
PR=$1
BRANCH=$2
if [ -z $PR ]; then
echo "Missing pull request number"
return 1
fi
if [ -z $BRANCH ]; then
BRANCH="pr-$PR"
fi
git fetch upstream pull/$PR/head:$BRANCH
git checkout $BRANCH
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment