什么会导致git中的子模块冲突,以及它们应该如何解决? [英] what causes submodule conflicts in git, and how should they be resolved?

查看:2992
本文介绍了什么会导致git中的子模块冲突,以及它们应该如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们经常看到子模块本身的合并冲突,没有文件冲突,只是子模块。我们使用子模块,我们对git是新手。在 git子模块摘要的输出中列出了多个版本。我们通过在超级项目中运行 git add< submodule> 来解决它们。

但是,今天我们有一位开发人员在解决了子模块时失去了提交以这种方式冲突。

是否运行git add选择远程版本?子模块的内容不应该合并?如果她在子模块中进行了更改(我认为),那么为什么在提交并解决冲突之后该提交会消失? 冲突和 子模块 当您当前的分支和你想合并的分支已经发生了分歧。

它仅仅意味着存在一个模棱两可的情况 - 你可以合法地想要要么在任何特定情况下赢。所以,虽然它看起来很烦人,但它们只是强调你丰富的选项来指定你想要的东西(而且你必须指定你想要的东西)。 (而且,所有程序员每天都在做的只是指定细节。)



好像git-add-the-sub-module-on-the-superproject应该有工作。但是,您也可以选择立即在该超级项目上进行混淆检查。这是在这个链接中提到的(解决子模块冲突),它讨论了 file 冲突和 summodule 冲突之间的区别,以及如何解决它们:



http://pacific.mpi-cbg。 de / wiki / index.php / Git_Conflicts


We are using submodules and we are new to git.

We often see merge conflicts for the submodules themselves, no files are conflicted, just the submodule. There are multiple versions listed in the output of git submodule summary. We resolve them by running git add <submodule> in the superproject.
But today we had a developer lose a commit of the submodule when she resolved the conflict in this manner.
Does running a git add choose the remote version? Shouldn't the contents of the submodule get merged? If she made changes in the submodule and committed them (which I see), then why would that commit disappear after she ran the pull and resolved the conflict?

解决方案

Both file conflicts and submodule conflicts occur when your current branch and the branch-you-want-to-merge-into have diverged.

It merely means an ambiguous situation exists -- you could legitimately want either to "win" in any given case. So, while it may seem "annoying", they merely highlight your rich options to specify what you want (and you must specify what you want). (And, all that programmers do every day is merely to specify detail.)

It seems like the git-add-the-submodule-on-the-superproject should have worked. However, you also had the option to git-checkout-on-the-superproject right away. This is mentioned in this link (resolving submodule conflicts), which talks about the difference between file conflicts and summodule conflicts, and how to resolve them:

http://pacific.mpi-cbg.de/wiki/index.php/Git_Conflicts

这篇关于什么会导致git中的子模块冲突,以及它们应该如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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