0

I'm trying to merge a branch with the master one. Surprisingly, git identified conflicts across different files! I'm used to conflicts in the same file but cannot understand the concept behind conflicts between different files.

Here is the case:

  • there are 2 branches: master and branch1
  • file1.ini:
    • in master: has been removed
    • in branch1: has been modified (compared to common ancestor with master)
  • master has a new file: folderA/file2.ini
  • file1 was not moved to folderA/file2.ini

After the merge command:

  • file1.ini has been deleted
  • new 'folderA/file2.ini`contains conflict markers like:

    <<<<<<< HEAD:file1.ini

    ...

    =======

    ...

    >>>>>>> master:folderA/file2.ini

I'm puzzled about the file mixing.

4

1 回答 1

1

Git 根据文件相似性进行动态重命名检测。删除比删除file1.ini更类似于保留folderA/file2.ini,因此 git 试图将其视为重命名和编辑。

(简而言之,在这种特殊情况下,这只是算法失灵。)

于 2013-10-18T19:24:53.203 回答