git - 无法在git中添加文件名不同大小写的文件原因

标签 git

我想运行:git add <folder>并且有多个文件具有不同的内容相同的文件名但大小写不同

例如,它们可能是 dir/DiffCONTENT.mkdir/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/

相关文章:

git - Teamcity:ssh socks5身份验证

Git 子树导出和重新导入问题

git - 将 git 的运行 merge 移动到无法比拟的位置

Git:在 refs/heads 中没有相应文件的分支

Git - 多环境开发

git - 如何快速从SVN迁移到Git?

Android Studio - 基于 Git 的多平台项目的 CRLF 与 LF

git - 复古从备份目录创建一个 git 存储库

asp.net-mvc - 使用 GIT for Visual Studio 2012 构建克隆项目时出现问题

php - 如何使用 composer 在团队中开发 PHP 包?