[英]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将提供有关如何将
dev
和FB-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.