我们正在修复我们的存储库问题,其中某些文件的路径大小写不同 - 路径中的第一个文件夹是一组文件的“应用程序”和另一组文件的“应用程序”。为此,我们在所有分支中将所有文件重命名为大写“应用程序”,并重新克隆整个存储库。
当我们尝试将一个分支 merge 到另一个分支时,对于许多文件,我们会看到:
CONFLICT (rename/delete):
Applications/Views/sell.cshtml deleted in HEAD and renamed in feature123_branch.
Version feature123_branch of Applications/Views/sell.cshtml left in tree.
Mergetool 提供了在使用重命名文件时删除文件的选项。
但是这个文件只是在 HEAD 和 feature123_branch 中都被重命名了,例如 github.com
显示
file renamed from {applications/ → Applications/}/Views/sell.cshtml for all commits.
我们可以使用“解决” merge 策略,文件将被正确标记为“都已重命名”,但我们不会丢失文件历史记录(根据我们的 git 专家关心)。
这里有一个问题:
我们如何使用 git 命令(与 github 提交历史相同)查看文件的真实历史,显示该文件已重命名?
为什么默认的“递归” merge 策略认为这个文件没有重命名而是在分支中被删除了?
如果我们将使用解析策略,文件历史会丢失吗?
附注 repo 是私有(private)的,所以我不能给链接,抱歉。
最佳答案
那是旧的,但关于:
How can we see real history of file with git command (same to github commit history) showing that file was renamed?
git log
有一个 --follow
选项:
--follow - Continue listing the history of a file beyond renames (works only for a single file).
关于Git merge 显示 'rename/deleted' 在两个分支中真正重命名的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15964404/