简体   繁体   English

处理向功能添加新迷你功能的正确方法,哪个分支已合并到主服务器中

[英]The right way to handle adding new mini-features to a feature, which branch has already been merged into master

I don't have too much experience working with git and currently I'm using the local one in Xcode 9 . 我没有太多使用git的经验,目前我在Xcode 9使用本地的。 I would like to understand the following: Let's say we have two features to implement, called feature1 and feature2 . 我想了解以下内容:假设我们有两个要实现的功能,称为feature1feature2

Now, to handle the feature1 we create a new branch from the master , called feature1_branch . 现在,为了处理feature1我们从master创建了一个名为feature1_branch的新分支。 After successfully implementing that feature, we merge it back into the master . 成功实现该功能后,我们将其合并回master

Then, we create a new branch for the feature2 , called feature2_branch . 然后,我们为feature2创建一个名为feature2_branch的新分支。 Now, we have successfully implemented it, but haven't merged it back into the master , and we suddenly realise that there is a mini-feature to be added to feature1 . 现在,我们已经成功实现了它,但还没有将它合并回master ,我们突然意识到有一个小功能要添加到feature1

So, what is the right policy here: should we merge feature2 into the master and create a new branch for that mini-feature, called feature1.1_branch , or should we branch from feature2_branch and create a new one for the mini-feature? 那么,这里的正确政策是什么:我们应该将feature2合并到master并为该迷你功能创建一个名为feature1.1_branch的新分支,还是应该从feature2_branch分支并为mini-feature创建一个新分支?

I believe that the second way isn't the right one, because I think intuitively that new branches, created from the existing one, should somehow be related to it, but feature1.1 has nothing to do with feature2 . 我认为第二种方式不是正确的方法,因为我直觉地认为,从现有分支创建的新分支应该以某种方式与它相关,但feature1.1feature2 But if this case isn't too wrong and we can follow it, how we could merge feature1.1_branch back? 但是,如果这个案例没有太大错误我们可以遵循它,我们如何将feature1.1_branch合并回去? I mean, should we first merge it into feature2_branch or directly into the master branch? 我的意思是,我们应该首先将它合并到feature2_branch还是直接合并到master分支中?

I would appreciate some explanation for this cases from you. 我很感激您对此案件的一些解释。 Thanks in advance. 提前致谢。

Since feature1_branch has been merged into master–which means it's now a permanent part of your code base, you shouldn't branch feature1.1 off it. 由于feature1_branch已合并为master - 这意味着它现在已成为代码库的永久部分,因此不应将feature1.1分支出来。 Just branch off master like it is a complete new feature that has nothing to do with feature1 ( feature1.1 and feature2 then become 2 parallel branches). 刚刚分离出master就像它是一个与feature1无关的完整新功能( feature1.1feature2然后成为2个并行分支)。

From what you describe, feature1.1 and feature2 are quite unrelated. 根据您的描述, feature1.1feature2是完全不相关的。 It should be then easy to merge them back. 然后应该很容易将它们合并。 This is similar to having two people working in parallel on different parts of the project: if their work are completely separate, they can just merge them back into master whenever they are done; 这类似于让两个人在项目的不同部分并行工作:如果他们的工作完全分开,他们只要完成就可以将它们合并回master ; there should be none or very little conflicts. 应该没有或只有很少的冲突。

It is certainly wrong to branch it off feature2_branch . 将它从feature2_branch分支出去肯定是错误的。

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

相关问题 已经与master合并的分支中的错误如何解决? - How to fix a bug in a branch after it has already been merged with master? 我如何知道一个分支是否已经合并到 master 中? - How can I know if a branch has been already merged into master? 问题将Git Feature分支合并到“Beta”分支(在它已经合并到“Develop”分支之后) - Issue merging Git Feature branch into “Beta” branch (after it has already been merged to “Develop” branch) 重新设置已经合并的分支 - Rebase a branch that has already been merged 功能分支合并到master后,我会继续做什么呢? - What shall I do after my feature branch has been merged into master but I have continued to work on it? 什么是最简单的方法将git上的所有提交返回到尚未合并的master分支? - Whats the simplest way to return all commits on git to master branch that have not been merged already? Git:如何删除已经提交,推送并合并到master的分支? - Git: How do I remove a branch that has already been committed, pushed, and merged into master? 已合并到母版中的功能分支上进行更改 - Made changes on a feature branch after it was already merged to master 检查develop分支是否已合并到功能分支中? - Checking if develop branch has been merged into feature branch? 我们可以在已经与 master 合并的分支上提交吗? - Can we commit on branch that's already been merged with master?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM