If you want to download GitHub PRs to your local repository, you can use a little trick to download them as local branches.
Open the repository configuration file (.git/config
) and search for the origin
block. Change it from:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:USERNAME/REPOSITORY.git
to (notice the fourth line):
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:USERNAME/REPOSITORY.git
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
Now fetch origin
again:
$ git fetch origin
and use git branch -a
to see all the PRs:
$ git branch -a
* master
...
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/pr/104
remotes/origin/pr/105
remotes/origin/pr/112
remotes/origin/pr/118
You can checkout to a specific PR:
$ git checkout origin/pr/118
and create a branch from it.