iwayneo iwayneo - 1 year ago 73
Git Question

How can I fetch an unmerged pull request for a branch I don't own?

I need to pull in a specific pull request (that hasn't been processed into the main stream yet) in the NServiceBus repo:


It's obviously not my repo, but I need the changes that exist in that pull request.

What is the best way to do this?

Answer Source

I am assuming you already have a working directory that tracks the repository the request is made to (you need somewhere to apply the changes to, right?).

Then simply tell git fetch to get a particular revision from a particular repository. If you go to the linked page, you see the URL https://github.com/johnsimons/NServiceBus.git and the commit ID d8524d53094e8181716e. Unfortunately fetch does not like revisions, only branches, so try

git fetch https://github.com/johnsimons/NServiceBus.git master

That will download the branch to your repository (where you should already have the branch this was forked from). Then ask git whether it knows that commit id. Then you can do whatever you want with it (create a branch from that revision, merge it to another branch etc.)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download