[英]Why does git merge generate conflicts across different files?
I'm trying to merge a branch with the master one. 我正在尝试将分支与主分支合并。 Surprisingly, git identified conflicts across different files!
出乎意料的是,git发现了不同文件之间的冲突! I'm used to conflicts in the same file but cannot understand the concept behind conflicts between different files.
我习惯于在同一个文件中发生冲突,但无法理解不同文件之间的冲突背后的概念。
Here is the case: 就是这种情况:
master
and branch1
master
和branch1
file1.ini
: file1.ini
:
master
: has been removed master
:已被删除 branch1
: has been modified (compared to common ancestor with master
) branch1
:已被修改(与master
共同祖先相比) master
has a new file: folderA/file2.ini
master
有一个新文件: folderA/file2.ini
file1
was not moved to folderA/file2.ini
file1
没有移到folderA/file2.ini
After the merge command: 合并命令后:
file1.ini
has been deleted file1.ini
已被删除 new 'folderA/file2.ini`contains conflict markers like: 新的'folderA / file2.ini'包含冲突标记,例如:
<<<<<<< HEAD:file1.ini <<<<<<< HEAD:file1.ini
... ...
======= =======
... ...
>>>>>>> master:folderA/file2.ini >>>>>>> master:folderA / file2.ini
I'm puzzled about the file mixing. 我对文件混合感到困惑。
Git does dynamic rename detection, based on file similarity. Git根据文件相似性进行动态重命名检测。 The removed
file1.ini
was more similar to the retained folderA/file2.ini
than the deletion, so git attempted to treat this as a rename-and-edit. 删除的
file1.ini
与保留的folderA/file2.ini
相比,与删除的更相似,因此git尝试将其视为重命名和编辑。
(In short, it's just an algorithm misfire in this particular case.) (简而言之,在这种特殊情况下,这只是算法失误。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.