将远程提交拉入我的分叉中
我想将另一个人的分支中的特定提交拉到我自己的分支中。这两个项目都是我们都不拥有的同一个项目的分支。提交的人尚未向我发送拉取请求,但无论如何我都希望他在我的分支中进行更改。
我将给出一个示例场景,
- 开发人员 Adam 在 GitHub 上创建了一个存储库
Adam/GameLib
。 - 我,Andreas,已经为这个存储库创建了自己的分支,并在单独的 Andreas/GameLib/dev 分支上进行了一些更改。
- 另一位开发人员 Bob 制作了自己的分支并注意到了一个错误,进行了更改并将其作为单个提交推送到他的
Bob/GameLib/master< /代码> 分支。
Bob 没有向我(Andreas)和原始创建者(Adam)发出拉取请求。然而,我仍然想将 Bob 的单个提交从 Bob/GameLib/master
拉到我的分支 Andreas/GameLib/dev
中。
我该如何正确地做到这一点? (即,不是强力下载 Bob 的代码作为 zip 并使用文本编辑器将他的更改合并到我的分支中)
I want to pull a specific commit from another person's branch into my own branch. Both project are forks of the same project which neither of us owns. The person who made the commit has not sent a pull request to me, yet I want his changes in my branch anyway.
I'll give an example scenario,
- Developer Adam has created a repository
Adam/GameLib
on GitHub. - I, Andreas, have made my own fork of this repository, and made some changes on a separate
Andreas/GameLib/dev
branch. - Another Developer, Bob, has made his own fork and noticed a bug, making the changes and pushing it as a single commit to his
Bob/GameLib/master
branch.
Bob has not made a pull request to neither me (Andreas) nor the original creator (Adam). Yet, I still want to pull Bob's single commit from Bob/GameLib/master
into my branch Andreas/GameLib/dev
.
How would I go about doing this properly? (i.e., not brute force downloading Bob's code as a zip and merging his changes into my branch with a text editor)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将他的存储库作为远程添加到您的存储库中,
为他的更改添加一个分支
现在,您可以获取鲍勃的更改
,看看是否可以将其合并到您自己的 patch_branch 中
,或者您选择他的更改,您必须在其他地方查找这些更改,因为这完全取决于 oyu 想要做什么。
You add his repo as a remote to your repo
Add a branch for his changes
Now you can fetch Bob's changes
and see if you can merge it into your own patch_branch
or you cherry pick his changes which you will have to look up elsewhere as this fully depends on what oyu are trying to do.
例如:
就是这么简单。
For example:
It's that simple.