git added by them renaming conflict - git recognis

2019-06-08 13:58发布

问题:

I've renamed a directory and merged it into my main branch, when merging another branch, git recognises the same files in the renamed directory as new files.

I get the merge conflict 'added by them' for the same files in that directory when merging in another's branch:

added by them: theirDir/same_file_name.xxx

I've renamed the directory in their branch to match and continue to get the 'added by them' conflict.

When I try to checkout --ours I get

$ git checkout dir/same_file_name.xxx --ours

error: path 'dir/same_file_name.xxx' does not have our version

At this point deleting this file actually, deletes the file after the merge completes.

How can I resolve this conflict?

--- m ----\ ------------  m1 --------------- mx ------- *!*
     \     \            /   \                /         /  
      \     dir-rename-/     file_revisions-/         /
       \                                             /
        f2 ---------- file added by them conflict --/

Multiple file revisions from multiple branches have occurred before the merge conflict.

回答1:

Instead of using msysgit 1.9.5, try the latest Git for Windows:

Since Git 2.18, git status does a better job detecting renamed (of files and folders)