PR 期间的 Git 合并冲突

编程入门 行业动态 更新时间:2024-10-19 06:23:10
本文介绍了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 -->大师.但是,我不断遇到第二个 PR development --> 的合并冲突.master 例如 Azure DevOps 上的 Added in BothEdited 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到developmentmaster.

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

我想知道的是,我看到的那些合并冲突是否是由于存储库的原始设置或压缩合并而发生的.developmentmaster的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:关键词]

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

发布评论

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

>www.elefans.com

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