只是一個猜測,但它聽起來像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