问题描述
我做了一些不寻常的设置,首先设置了存储库,而不是用项目文件填充 master
分支,而是创建并填充了 transfer
分支.然后,文件通过 PR 拉入 development
,然后通过另一个 PR 再次拉入 master
.
I did a bit unusual setup where repositories were first set up, instead of populating the master
branch with project files, a transfer
branch was created and populated. Then, files were pull into development
via PR and then again into master
via another PR.
而且,接下来,主题分支是在 development
分支之外创建的.完成后,为 topic
创建 PR -->development
和另一个用于 development
的 PR -->大师
.但是,我不断遇到第二个 PR development
--> 的合并冲突.master
例如 Azure DevOps 上的 Added in Both、Edited in Both 等.
And, going forward, topic branches are created off development
branch. Once done, PR was created for topic
--> development
and another PR for development
--> master
. But, I keep getting merge conflict for second PR development
--> master
such as Added in Both, Edited in Both etc on Azure DevOps.
目前只使用squash merge来完成PR到development
和master
.
Right now, only squash merge is used to complete PR into both development
and master
.
我想知道的是,我看到的那些合并冲突是否是由于存储库的原始设置或压缩合并而发生的.development
和master
的PR的diff
也包含了很多我没想到的变化.
What I want to know is whether those merge conflicts I am seeing happen due to the original setup of the repository or squash merge. The diff
of PR for development
and master
also contains a lot of changes I do not expect, too.
我无法理解它.
推荐答案
发生冲突是因为您使用了squash";合并并不断重新整合一个分支.与壁球"您没有进行真正的合并(换句话说:历史没有连接).相反,您正在 master
分支上创建一个新的提交.
The conflicts happen because you are using "squash" merge and continuously reintegrate one branch. With "squash" you are not doing a real merge (in other words: the history is not connected). Instead you are creating a single new commit on master
branch.
稍后,当您尝试将 development
合并到 master
时,所有先前来自 development 的更改将再次合并(但它们已经存在于 master
>).这就是为什么你会看到冲突.
Later, when you try to merge development
to master
, all previous changes from development would be merged again (but they already exist in master
). That's why you see conflicts.
我看到 2 个选项:
不要使用壁球"完全用于重新集成分支并使用常规合并在每次合并后从master
重新创建 development
Don't use "squash" at all for re-integration branches and use regular merges
Re-create the development
from master
after every single merge
这篇关于PR 期间的 Git 合并冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论