解决仅对某些文件的合并冲突,并提交其他团队的分支来解决它们的冲突 [英] Resolve merge conflict only for some files and commit to branch for other teams to resolve theirs

查看:58
本文介绍了解决仅对某些文件的合并冲突,并提交其他团队的分支来解决它们的冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简而言之,我们有一个存储库来托管不同功能团队(例如服务器端,移动,ci,自动化质量检查等)的代码.

In short, we have one repo which hosts code for different functional teams, i.e. server-side, mobile, ci, automation qa etc.

现在,当我们尝试从支持分支的错误修复中撤退到dev-release-branch时,出现了许多与不同团队/开发区域相关的冲突.由于我们没有一个人同时负责服务器端和移动端,因此很难解决一个人的冲突.

Now when we are trying to pull down from support-branch bug fixes into dev-release-branch a lot of conflicts appear related to different teams/areas of development. Since we don't have single person covering server-side and mobile, it's really tough to resolve conflicts for one individual.

这里的问题是:是否可以通过某种方式仅解决一些冲突(例如服务器端),然后推送到中间分支,并让其他团队解决与他们的开发领域有关的冲突.只有在所有团队解决了所有冲突之后,才最终合并中间分支.

The question here is: is it possible somehow to resolve only some of the conflicts (e.g. server-side), then push to intermediate branch, and let other teams resolve conflicts related to their area of development. And only after all teams resolve all the conflicts finally merge intermediate branch.

也许我们在这里做错了.任何建议将不胜感激(除了将代码库分成单独的存储库,为此为时已晚).

Maybe we are doing something wrong here. Any suggestions would be appreciated (except splitting code base into separate repo, too late for this).

推荐答案

git checkout -b server-team-merge dev-release-branch
git merge support-team-fixes
# fix the conflicts you can fix here
git commit -m "server-team partial merge of $(git describe support-team-fixes)"

,其他团队也是如此.然后合并部分合并分支-如果结果确实不相交,则可以一次完成所有操作,这将是一件微不足道的操作,

and each other team does likewise. Then merge the partial-merge branches -- if the results were truly disjoint you can do them all at once, it'll be a trivial operation,

git checkout dev-release-branch
git merge {server,mobile,ci,automation}-team-merge

但是,如果那一次抱怨将它们一次合并在一起,以提出关于如何解决某些冲突的不同想法.

but if that complains merge them in one at a time to ferret out the different ideas about how some of the conflicts should be resolved.

合并分支时,git会将结果视为合并的历史记录在结果提交中的正确且完整的合并,因此任何后续合并都将整个历史记录标识为共享的,因此无需执行任何操作.但是,如果您从同一个父母那里进行了多次独立合并,那么这些合并就不会出现在彼此的历史中,并且可以得到您想要的任何结果;在这些结果的后续合并中,Git可以查看提交的祖先并确定正确的基础.

When you merge a branch, git regards the result as a correct and complete merge of the merged history in the resulting commit, so any subsequent merge will identify the entire history as shared and there'll be nothing left to do. But if you do multiple independent merges from the same parents, those merges aren't in each others' histories and can have any results you want; in subsequent merges of those results Git can see the commits' ancestry and identify the correct base.

这篇关于解决仅对某些文件的合并冲突,并提交其他团队的分支来解决它们的冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆