[英]git: merging changes from multiple branches
I was working on feature branch fb1 and realized I needed some new features, but they should happen on master . 我当时在功能分支fb1上工作,意识到我需要一些新功能,但是它们应该在master上发生。 So I branched master to fb2 and built my features.
因此,我将master分支到fb2并构建了我的功能。
Now fb2 needs testing before I merge it into master but I'd like to continue working on fb1 in the mean time. 现在,fb2需要进行测试,然后再将其合并到master中,但是在此之前,我想继续研究fb1。 However I need fb1 to contain the changes on fb2.
但是我需要fb1来包含fb2上的更改。 They both need to stay up to date with master.
他们俩都需要跟上大师。
I have tried to merge from both branches, and also like fb1 < fb2 < master, but both of those got ugly fast and I ended up backing out. 我试图从两个分支机构进行合并,并且也像fb1 <fb2 <master那样进行合并,但是这两个都变得很快,我最终退出了。
I would to learn a new workflow for this if anyone has suggestions. 如果有人提出建议,我将为此学习一个新的工作流程。
You can rebase fb1 onto fb2: 您可以将fb1重新设置为fb2:
git rebase --onto fb2 master fb1
Git will take the commits between master and fb1 and re-creates them on top of fb2 that look the same. Git将接受master和fb1之间的提交,并在看起来相同的fb2之上重新创建它们。 Do not rebase already published history and make sure you understand the implications.
不要重新设置已经发布的历史记录,并确保您了解其中的含义。 For first-time rebase users backups are recommended ;)
对于初次使用rebase的用户,建议备份;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.