只是一个猜测,但它听起来像Git的重命名检测合并时没有检测到重命名。这个目录中有很多文件吗?所有的文件是否被大量修改?
尝试在增加merge.renameLimit
或diff.renameLimit
配置设置的值后重新进行合并/拉取。从git help config
:
diff.renameLimit
The number of files to consider when performing the copy/rename
detection; equivalent to the git diff option -l.
merge.renameLimit
The number of files to consider when performing rename detection
during a merge; if not specified, defaults to the value of
diff.renameLimit.
您也可以尝试-Xrename-threshold=70
降低重命名相似性检测阈值。从git help merge
(也git help pull
):
rename-threshold=<n>
Controls the similarity threshold used for rename detection.
See also git-diff(1) -M.
从git help diff
:
-M[<n>], --find-renames[=<n>]
Detect renames. If n is specified, it is a threshold on the
similarity index (i.e. amount of addition/deletions compared to the
file’s size). For example, -M90% means git should consider a
delete/add pair to be a rename if more than 90% of the file hasn’t
changed.
请注意,我不知道当行尾Unix的风格和Windows之间的风格转换会发生什么。即使唯一的区别是行结尾,Git可能会认为这些文件是100%不同的,因此请确保您使用的是相同的行结尾。
你可以告诉git忽略空白变化,解决了行结束问题。另见http://stackoverflow.com/questions/861995/is-it-possible-for-git-merge-to-ignore-line-ending-differences – 2012-03-29 17:29:49