简体   繁体   English

将文件从功能分支合并到开发分支

[英]Merging files from a feature branch to dev branch

I have one dev branch and several feature branches. 我有一个开发分支和几个功能分支。 I found this git workflow on Atlassian. 我在Atlassian上找到了这个git工作流程。 THe idea is the dev branch will be read only for all developers except for the moderator(s). 这个想法是dev分支将仅对所有开发人员(主持人除外)只读。 All developers will work only off of the feature branches. 所有开发人员只能在功能分支之外工作。 But here's the problem - 但这是问题所在-

Dev A starts working on a feature branch A (FB-A). 开发人员A开始在功能分支A(FB-A)上工作。 The Dev branch will get progressed in the mean time. 同时,Dev分支将取得进展。 Dev A finishes his work on FB-A and commit and pushes code to FB-A (Commit #1). 开发人员A完成FB-A的工作并提交并将代码推送到FB-A(提交#1)。 He will then do a pull from Dev to FB-A to get the latest. 然后,他将从Dev撤至FB-A,以获取最新消息。 All changes from the Dev will get added/modified to FB-A. 开发人员的所有更改都将添加到FB-A中或对其进行修改。 He will then commit and push these files to FB-A as well (Commit #2). 然后,他还将提交这些文件并将其推送到FB-A(提交2)。 Now, the files are ready to be merged to dev branch. 现在,可以将文件合并到dev分支了。 When I tried to do it, it commits Commit #1 and Commit #2. 当我尝试执行此操作时,它将提交Commit#1和Commit#2。 Is this normal practice? 这是正常的做法吗?

Is it possible to have only the first commit merged to Dev as it has the developer's actual changes? 是否可以仅将第一个提交合并到开发人员中,因为它具有开发人员的实际更改? Am I missing something here? 我在这里想念什么吗?

From your description, it seems like commit #2 is a merge commit. 根据您的描述,似乎提交#2是合并提交。 This is good practice, because if you already have recently merged dev into FB-A by the time you merge FB-A into dev , you will likely have little to no merge conflicts. 这是一个好习惯,因为如果您最近在将FB-A合并到dev时已经将dev合并到FB-A ,则合并冲突可能很小甚至没有。 Commit #2 will have important information on how to merge updates in dev and FB-A together, so it is normal practice to keep the merge commit. 提交#2将提供有关如何将devFB-A更新合并在一起的重要信息,因此保留合并提交是正常的做法。 It is also normal for this merge commit to land on the dev branch when you merge it in, since you are adding commits from FB-A that weren't in dev to dev . 合并合并时,将合并提交放置在dev分支上也是正常的,因为您是将FB-A中不在dev提交添加到dev

Note: Even if you wanted to remove commit #2 before merging into dev , you would likely need to create another merge commit anyway to resolve conflicts. 注意:即使您想在合并到dev之前删除提交#2,也可能仍然需要创建另一个合并提交来解决冲突。

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

相关问题 为什么将主分支合并到功能分支会从 GIT 中的功能分支中删除文件? - Why merging master branch to feature branch is deleting files from feature branch in GIT? 从提交合并到功能分支 - Merging from commit to feature branch git 分支 - 合并功能分支到发布和开发分支 - git branching - merging feature branch to release and dev branch 将 Dev 分支中的文件与 Master 分支对应项取消关联,以便它们在合并后保持独立 - Disassociating Files in Dev Branch from Master Branch Counterparts So They Remain Separate After Merging master分支和dev分支合并的区别 - Difference of merging from master branch and from dev branch 将 master 合并到 dev/branch 将覆盖 dev/branch - Merging master into dev/branch will overwrite dev/branch 在合并到 dev 之前通过 AppCenter 测试移动应用功能分支 - Testing mobile app feature branch via AppCenter before merging into dev 将变更从master合并到已发布的功能分支中 - merging changes from master into a published feature branch Git - 当功能分支包含大量更改时,如何在将功能分支合并到开发时避免冲突 - Git - how to avoid conflict when merging feature branch to dev when feature branch contains lots of changes 获取从主分支到功能分支的更改而不合并任何内容 - Get changes from main branch to feature branch without merging anything
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM