简体   繁体   English

git合并子分支之前合并到母版

[英]Git merging sub branches before merging to master

I have branch A . 我有分公司A。 I know that it is save but because of some procedures I can't merge it to master branch(in my case it is code review I need to wait some of my colleagues to review my code ). 我知道它可以保存,但是由于某些过程,我无法将其合并到master分支(在我的情况下是代码审查,我需要等待一些同事审查我的代码)。 Now I need to start another feature let say this one is branch B. 现在,我需要启动另一个功能,假设这个功能是分支B。

Branch B depends on some features that I implemented in branch A. But since I couldn't merge A to master, B does not has this features. 分支B依赖于我在分支A中实现的某些功能。但是由于我无法将A合并到主服务器,因此B没有此功能。

Is it a good idea in my case to merge branch A directly to branch B even before merging A to master? 在我的情况下,甚至在将A合并为master之前,将A分支直接直接合并为B是一个好主意吗?

You can just create new branch B from branch A (not "merge A directly to branch B "): 您可以只从分支A创建新的分支B (而不是“直接将A合并到分支B ”):

git branch B A
git checkout B

Do your work. 做你的工作。 After branch A is merged to master , use rebase : 将分支A合并到master ,使用rebase

git checkout B
git rebase master

Continue to work on branch B 继续在B分支工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM