他们添加的git重命名冲突-git将重命名目录中的相同文件识别为新文件 [英] git added by them renaming conflict - git recognises the same files in the renamed directory as new files
问题描述
我已经重命名目录并将其合并到我的主分支中,合并另一个分支时,git会将重命名目录中的相同文件识别为新文件.
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.
如何解决此冲突?
--- 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.
推荐答案
而不是使用msysgit 1.9.5,请尝试使用适用于Windows的最新Git :
Instead of using msysgit 1.9.5, try the latest Git for Windows:
自Git 2.18 起,git status
可以更好地检测文件和文件夹的重命名
Since Git 2.18, git status
does a better job detecting renamed (of files and folders)
这篇关于他们添加的git重命名冲突-git将重命名目录中的相同文件识别为新文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!