Created
March 28, 2017 09:31
-
-
Save vnl/88e076a857d0455adc0fe292ce4d3d6e to your computer and use it in GitHub Desktop.
Checkout github pull requests locallly
This file contains 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
Locate the section for your github remote in the `.git/config` file. It looks like this: | |
``` | |
[remote "origin"] | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
url = gitgitgitgit.git | |
``` | |
Now add the line `fetch = +refs/pull/*/head:refs/remotes/origin/pr/*` to this section. | |
Kindly change the github url to match your project's URL. It ends up looking like this: | |
``` | |
[remote "origin"] | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
url = gitgitgitgit.git | |
fetch = +refs/pull/*/head:refs/remotes/origin/pr/* | |
``` | |
Now fetch all the pull requests: | |
``` | |
$ git fetch origin | |
From github.com:gitgitgit/node | |
* [new ref] refs/pull/123/head -> origin/pr/123 | |
* [new ref] refs/pull/133/head -> origin/pr/133 | |
* [new ref] refs/pull/144/head -> origin/pr/144 | |
* [new ref] refs/pull/155/head -> origin/pr/155 | |
... | |
``` | |
To check out a particular pull request: | |
``` | |
$ git checkout pr/666 | |
Branch pr/666 set up to track remote branch pr/666 from origin. | |
Switched to a new branch 'pr/666' | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment