标签云

微信群

扫码加入我们

WeChat QR Code


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

2019年01月21日43分54秒

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

2019年01月21日43分54秒

possible duplicate of github clone from pull request?

2019年01月21日43分54秒

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

2019年01月21日43分54秒

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

2019年01月21日43分54秒

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

2019年01月21日43分54秒

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

2019年01月21日43分54秒

how to revert ?

2019年01月21日43分54秒

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.

2019年01月21日43分54秒

It may be the case that you configured your local repo the way that origin points to your fork and upstream – to the original repository (following help.github.com/articles/configuring-a-remote-for-a-fork, for instance). Make sure to change origin to upstream in the mentioned command, if you want to fetch pull request from the original repo.

2019年01月21日43分54秒

It worked for me too, thanks! :)

2019年01月22日43分54秒

This is sufficient indeed, tks

2019年01月21日43分54秒

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

2019年01月21日43分54秒

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.

2019年01月21日43分54秒

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

2019年01月21日43分54秒

I'd go even one better - I would create a worktree, set it to a new test branch and THEN pull in the PR - that way I don't need about restoring branches locally when done; I just dispose of the worktree. In fact I NEVER just checkout -b anymore - I always create a worktree and then branch. Disk is cheap. Of course, I have a script that does this; I don't type all the command needed individually.

1970年01月01日00分03秒

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!

2019年01月21日43分54秒

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!

2019年01月21日43分54秒