Drop the above file, called git-getpr
into your PATH and you can then pull a PR (assuming you have set the source repo remote as upstream
):
git getpr <PR ID>
This will pull the PR into a local branch called pr/<PR ID>
#!/bin/bash | |
PRID=$1 | |
RE='^[0-9]+$' | |
if ! [[ $PRID =~ $RE ]] ; then | |
echo "error: PR Id is not a number" >&2; exit 1 | |
fi | |
git fetch upstream pull/${PRID}/head:pr/${PRID} | |
git checkout pr/${PRID} |