Skip to content

Instantly share code, notes, and snippets.

@millerdev
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save millerdev/59a4173abbf07e312f60 to your computer and use it in GitHub Desktop.
Save millerdev/59a4173abbf07e312f60 to your computer and use it in GitHub Desktop.
git pr - Fetch GitHub pull request to a new branch
#! /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
@millerdev
Copy link
Author

Create this script somewhere in your path. Don't forget to chmod +x /path/to/git-pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment