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.

Derek
  • 3,295
  • 3
  • 24
  • 31
  • Was the commit in which `file1.ini` was deleted different from the commit in which it was added back as `folderA/file2.ini`? – aij Mar 15 '19 at 16:05

1 Answers1

1

Git does dynamic rename detection, based on file similarity. 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.

(In short, it's just an algorithm misfire in this particular case.)

torek
  • 448,244
  • 59
  • 642
  • 775
  • Thanks! I will try the following for avoiding this detection http://stackoverflow.com/questions/6013261/disable-git-rename-detection – Derek Oct 20 '13 at 18:04