标签云

微信群

扫码加入我们

WeChat QR Code

I'd like to check out a previously created pull request (created via GitHub web interface). I searched and found different places where a refs/pull or refs/pull/pr

But when I add fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to the git config file and do a git fetch

What I'm doing wrong? Should GitHub create automatically the pull/xyz stuff, or do I have to configure something?


What does the complete remote section of your config file look like?

2018年08月16日26分35秒

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

2018年08月16日26分35秒

possible duplicate of github clone from pull request?

2018年08月16日26分35秒

I ended up on this question, but I actually needed stackoverflow.com/q/1783405/2413303

2018年08月16日26分35秒

The second paragraph is not a complete sentence. "But when I add ... and do a git fetch" - when you do these things what happens?

2018年08月15日26分35秒

I used this to fetch a pr from an upstream repo into my local forked repo, you can replace origin with upstream as well.

2018年08月16日26分35秒

My command ended up looking like git fetch origin pull/1/head:githubusername , not what I was expecting

2018年08月16日26分35秒

how to revert ?

2018年08月15日26分35秒

Antoine BRANCHNAME is whatever you want to name the branch. I'm guessing you tried to use a name that already existed (e.g. master) and that didn't work, so you tried your username, which did work, because their was no branch with that name. Perhaps I misunderstand what you were saying.

2018年08月16日26分35秒

It worked for me too, thanks! :)

2018年08月16日26分35秒

This is sufficient indeed, tks

2018年08月16日26分35秒

This one worked for me, timbo's fetch method did something but not the right thing

2018年08月16日26分35秒

Note that if you do this while on your master branch, for example, it will commit directly into this branch. If you'd like to bring the pull request into a separate branch for staging, try timbo's answer.

2018年08月16日26分35秒

Ditto what phoenix said. I want the pull request branch duplicated on my machine under its own branch, not master.

2018年08月16日26分35秒

Say, is there actually a way - when you are looking at github.com I mean - to download the new/changed files, of the PR? So, when you are looking at a repo on github, you can click the handy "download as a zip" button, or indeed, you can, quite simply, click through and just look at each (entire) file of the project. For PR, I can't see how to, simply, click through to "look at the file" - know what I mean? Am I missing something? Cheers!

2018年08月15日26分35秒

I hit exactly this problem with the git fetch origin pull/ID/head:BRANCHNAME approach mentioned in stackoverflow.com/a/30584951/659732. Thanks for the solution!

2018年08月15日26分35秒