PR期间Git合并冲突

编程入门 行业动态 更新时间:2024-10-24 12:31:04
本文介绍了PR期间Git合并冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我做了一些不寻常的设置,即首先建立存储库,而不是用项目文件填充 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-> master .但是,在第二次PR development ->中,我不断遇到合并冲突. master ,例如在Azure DevOps上的两者都添加,两者都编辑等.

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.

现在,只有壁球合并用于将PR完成到 development 和 master 中.

Right now, only squash merge is used to complete PR into both development and master.

我想知道的是,我看到的那些合并冲突是否由于存储库或壁球合并的原始设置而发生.PR用于 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.

我无法解决这个问题.

推荐答案

发生冲突是因为您使用的是南瓜".合并并不断重新整合一个分支.与南瓜"您没有进行真正的合并(换句话说:历史未连接).相反,您是在 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 时,所有先前的开发更改将再次合并(但它们已经存在于 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

更多推荐

PR期间Git合并冲突

本文发布于:2023-10-17 10:28:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1500650.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:冲突   PR   Git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!