Skip to content

Instantly share code, notes, and snippets.

@coridrew
Forked from piscisaureus/pr.md
Last active December 6, 2015 17:27
Show Gist options
  • Save coridrew/be80962b50b6e25b2a94 to your computer and use it in GitHub Desktop.
Save coridrew/be80962b50b6e25b2a94 to your computer and use it in GitHub Desktop.
Checkout github pull requests locally
  1. Add global fetch remote for ALL pull requests for all repos:
> git config --global --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"
  1. Now fetch all the pull requests:
$ git fetch origin
From github.com:joyent/node
 * [new ref]         refs/pull/1000/head -> origin/pr/1000
 * [new ref]         refs/pull/1002/head -> origin/pr/1002
 * [new ref]         refs/pull/1004/head -> origin/pr/1004
 * [new ref]         refs/pull/1009/head -> origin/pr/1009
...
  1. To check out a particular pull request:
$ git checkout pr/999
Branch pr/999 set up to track remote branch pr/999 from origin.
Switched to a new branch 'pr/999'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment