Last active
August 29, 2015 14:02
-
-
Save millerdev/59a4173abbf07e312f60 to your computer and use it in GitHub Desktop.
git pr - Fetch GitHub pull request to a new branch
This file contains hidden or 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 [ -z "$1" ]; then | |
echo "Fetch GitHub pull request to a new branch" | |
echo "" | |
echo "usage: git pr PULL_REQUEST_NUMBER [BRANCH_NAME]" | |
exit; | |
fi | |
pr_num="$1" | |
if [ -z "$2" ]; then | |
branch_name=pull-request-"$pr_num" | |
else | |
branch_name="$2" | |
fi | |
git fetch origin pull/$pr_num/head:$branch_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create this script somewhere in your path. Don't forget to
chmod +x /path/to/git-pr