Git从别人的分支合并 [英] Git merge from someone else's fork
问题描述
我想:
- 创建新分行
- 将他们的更改合并到我的分行中
我创建了新分支:
git commit -b my_new_branch
我如何将他们的代码合并到这个新分支中?
这是我创建的分支: https://github.com/poundifdef/VirginMobileMinutesChecker/tree/widget_toast
这是我想合并的分支:
< a href =https://github.com/xbakesx/VirginMobileMinutesChecker =noreferrer> https://github.com/xbakesx/VirginMobileMinutesChecker
做这件事的最好方法是什么?我试过一个拉,它不会工作。我真的不知道我在gitland上做了什么,所以如果有更好的方法来实现这一点(除了我创建一个分支,并试图合并),那么我都是耳朵!
添加他们的github fork repo作为您自己的repo的克隆的远程服务:
git remote将other-guys-repo< url添加到其他人回购>
获取更改:
git fetch other-guys-repo
检出您想要的分支合并:
git checkout my_new_branch
合并其中的更改(假设他们在master分支上完成了工作):
git merge other-guys-repo / master
解决冲突,提交解决方案和瞧。
I have a repository on github, and someone else has forked it and made changes.
I want to:
- Create a new branch
- Merge their changes into my branch
I have created the new branch:
git commit -b my_new_branch
How do I merge their code into this new branch?
This is the branch that I have created: https://github.com/poundifdef/VirginMobileMinutesChecker/tree/widget_toast
This is the branch that I want to merge: https://github.com/xbakesx/VirginMobileMinutesChecker
What is the best way to do this? I've tried a "pull" and it won't work. I honestly have no idea what I'm doing in gitland, so if there is a better way to accomplish this (besides my creating a branch and trying to merge) then I am all ears!
Add their github fork repo as a remote to a clone of your own repo:
git remote add other-guys-repo <url to other guys repo>
Get their changes:
git fetch other-guys-repo
Checkout the branch where you want to merge:
git checkout my_new_branch
Merge their changes in (assuming they did their work on the master branch):
git merge other-guys-repo/master
Resolve conflicts, commit the resolutions and voila.
这篇关于Git从别人的分支合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!