合并子模块时提供三个提交引用 [英] Three commit references when merging submodules
问题描述
我正在合并使用git子模块的项目中的分支。通常当发生冲突时,有两套变更,他们和我们的变更。解决冲突就是将这两者合并为一个。但我注意到,对于git子模块,diff显示第三个值:
diff --cc my_submodule
索引dd7404e, e6753b1..0000000
--- a / my_submodule
+++ b / my_submodule
@@@ -1,1 -1,1 +1,1 @@@
- 子项目提交dd7404e5f35ee0b0064f0d6ed8201cc39d6ed6b2
- 子项目提交e6753b1142cf0350608720ff23f7ecf51b813cd9
++子项目提交3b4e75fbb7c55cf21e19509bbbbfabfa1fc10630
- , - 和++是什么意思?
请注意,子模块版本可能在合并之前在资源库中实际检出他们都不是我们的,他们会解释这三个哈希值吗?
解决方案 它只是表示子模块 gitlink (在父资料库的索引)在源文件中被改变了 e和目的地。
(参见 git diff
手册页)
++
不出现在branch1或branch2中
From Git Tools - 高级合并:
您有三个SHA1,因为在冲突中,Git将所有这些版本存储在阶段下的索引,每个索引都有与它们相关的数字。第一阶段是共同的祖先,第二阶段是你的版本,第二阶段是你的版本,第二阶段是你的版本,
MERGE_HEAD
,您正在合并的版本(他们)。组合diff格式 部分包含所有详细信息:
当由
显示时,git diff-files - c
(合并文件的组合差异),它将两个未解决的合并父代与正在工作的树文件进行比较。
Ie
file1
是阶段2 aka我们的版本,
file2
是阶段3,又名他们的版本。
$ b $-
列中的字符N
表示该行出现在fileN
中,但不会出现在结果中。
A+在
字符表示该行出现在结果中,并且N
列中的fileN
没有那条线。
您的情况: I am merging a branch in a project that uses git submodules. Usually when there is a conflict there are two sets of changes, theirs and ours. Resolving the conflicts is about merging these two into one. But I noticed that for git submodules the diff shows a third value: What do the "- ", " -" and "++' mean? Note that it's possible that the submodule version actually checked out in the repository before the merge was neither theirs nor ours, would that explain the three hashes? It simply means the submodule gitlink (the special entry in the index of the parent repo) was changed both in source and destination. From Git Tools - Advanced Merging: You have three SHA1 because in a conflict, Git stores all of these versions in the index under "stages" which each have numbers associated with them. The combined diff format section has all the details: When shown by I.e. A In your case: 这篇关于合并子模块时提供三个提交引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
-
意味着 file1
,意思是阶段2,意思是我们的版本。
-
意味着 file2
,意思是阶段3,意思是他们的。
++
'表示不在 file1
或
2
(每一次与第一阶段的共同祖先进行比较)
diff --cc my_submodule
index dd7404e,e6753b1..0000000
--- a/my_submodule
+++ b/my_submodule
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit dd7404e5f35ee0b0064f0d6ed8201cc39d6ed6b2
-Subproject commit e6753b1142cf0350608720ff23f7ecf51b813cd9
++Subproject commit 3b4e75fbb7c55cf21e19509bbbbfabfa1fc10630
(See git diff
man page)++
means one line that was added does not appear in either branch1 or branch2
MERGE_HEAD
, the version you’re merging in ("theirs").
git diff-files -c
(combined diff of merged files), it compares the two unresolved merge parents with the working tree file
file1
is stage 2 aka "our version", file2
is stage 3 aka "their version". -
character in the column N
means that the line appears in fileN
but it does not appear in the result.
A +
character in the column N
means that the line appears in the result, and fileN
does not have that line".
-
in the first column means file1
, meaning stage 2, meaning "ours" version. -
in the second column mean file2
, meaning stage 3, meaning "theirs". ++
' means an addition which was not in file1
or 2
(each time when compared with the common ancestor from stage 1)