我想运行:git add <folder>
并且有多个文件具有不同的内容和相同的文件名但大小写不同。
例如,它们可能是 dir/DiffCONTENT.mk
和dir/diffcontent.mk
。请记住,它们具有不同的内容和相同的文件名,只是大小写不同。
当我 git add dir/
,我收到一个错误:
fatal: Will not add file alias 'dir/DiffCONTENT.mk' ('dir/diffcontent.mk' already exists in index)
即使我尝试过git --all --ignore-errors --force dir/
,我还是解决不了这个问题。
我无法一一更改文件名,我什至不知道有多少相同大小写的文件。
最佳答案
Git 区分大小写,但我认为您的文件系统不区分大小写。
也许你可以将其设置为 true :
core.ignorecase
If true, this option enables various workarounds
to enable git to work better on filesystems that are not case sensitive,
like FAT. For example, if a directory listing finds "makefile" when git expects
"Makefile", git will assume it is really the same file, and continue to remember
it as "Makefile".
The default is false, except git-clone(1) or git-init(1) will probeand set
core.ignorecase true if appropriate when the repository is created.
但我认为您最好使用快速脚本重命名文件。
关于git - 无法在git中添加文件名不同大小写的文件原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22248334/