View Help
git_clone_pr
Checkout PR 1234 from the apache
remote to default branch pr1234
git_clone_pr apache 1234
Checkout PR 1234 from the apache
remote to custom branch bobspr
git_clone_pr apache 1234 bobspr
git_clone_pr(){ | |
remoterepo=$1 | |
pr_id=$2 | |
newbranch=$3 | |
if [ -z "$remoterepo" ]; then | |
echo "usage: git_clone_pr <remoterepo> <pr_id> [<newbranch>]" | |
else | |
if [ -z "$newbranch" ]; then | |
newbranch="pr${pr_id}" | |
fi | |
echo "Checking out PR ${pr_id} from ${remoterepo} to localbranch ${newbranch}" | |
git fetch ${remoterepo} pull/${pr_id}/head:${newbranch} | |
git checkout ${newbranch} | |
fi | |
} |