Say I have this pull request and I want to download it as if it was its own separate project. How do I go about doing that? I don't see any button for that functionality.
-
Note the source of the pull request "mlwelles:master". If you go to the user mlwelles's repos you will find https://github.com/mlwelles/AFOAuth2Client the master branch is where this code is. – JDwyer Dec 03 '13 at 04:07
-
Hmm. What if the user had hundreds of repos though? There's no simple "jump" button from the pull request page? – Doug Smith Dec 03 '13 at 04:10
-
GitHub automatically names the repository so hopefully it will be named the same as the original just with a different user. They do allow changing the name after forking, it still indicates the main repo "MvvmCrossRenamed forked from MvvmCross/MvvmCross" on the "Repositories" tab. – JDwyer Dec 03 '13 at 04:16
-
No there isn't and that's why github pull requests are not as useful as the ones created by `git pull-request`. – Noufal Ibrahim Dec 03 '13 at 05:15
3 Answers
You can download a snapshot of the tree at that commit over here. This is an exported tarball so you won't have any history. Is that what you're looking for? You can get to this by first looking at the commits he wants you to pull and then picking the latest one in the list. Navigating to this URL will give you the diff (i.e. it's examining the commit object rather than actual tree). You can now simply change the commit
in the above url to tree
or click on the "Browse code" button. Once you do that, there's a "Download ZIP" button on the right which allows you to download the tree.
If you want complete history, then you need to fetch mlwelles changes. You can do this by going to the mlwelles:master
repository over here and adding that as a remote to your own local clone using git remote add mlwelles git@github.com:mlwelles/AFOAuth2Client.git
. Then you can fetch the changes he's asking you to merge using git fetch remote master
. The changes will be available in FETCH_HEAD
. You can either view them using git checkout FETCH_HEAD
and git log
(or whatever), view the diffs using git diff FETCH_HEAD
(against your current branch) or finally integrate the changes he's asking you to using git merge FETCH_HEAD
. Once you do this, you can push the changes to your own repository using git push origin master
(assuming the original repository is added as origin
).

- 71,383
- 13
- 135
- 169
-
3How did you get to that? And yes, that's mostly what I wanted. But what if I simply had a copy of the main repo on my computer and wanted to merge the pull request from the command line? Is that possible? If so, do I merge it as a remote? If so (lots of if sos...) where do I get the remote's URL? – Doug Smith Dec 03 '13 at 04:08
-
-
Just updated the answer. I think it should be more useful to you now. – Noufal Ibrahim Dec 03 '13 at 04:55
-
For me it seem to work, but with another URL: https://github.com/sosedoff/pgweb/tree/pull/308/head - note that tree is located after the repo name, and head is given instead of the hash. – budden73 Feb 11 '19 at 21:05
In case you are just interested in a tar or zip archive, there is actually an API for that. You can use a link like the following to download the content of the pull request:
https://api.github.com/repos/AFNetworking/AFOAuth2Manager/zipball/pull/55/head
The important part is that the part behind the /zipball/ (or /tarball/) must be a valid git reference. For pull requests this would be pull/ID/head there ID is the pull requests ID. See step 5 of this guide.

- 331
- 3
- 11
Did you check this answer already?
Will look something like this for Michael's pull request:
git clone https://github.com/mlwelles/AFOAuth2Client.git -b master
which ended up giving me a clone of Michael's pull request locally.