乐闻世界logo
搜索文章和话题

How do i commit case sensitive only filename changes in git?

1个答案

1

Git has a configuration setting that determines whether it treats the file system as case-sensitive or case-insensitive: core.ignorecase. To instruct Git to handle the file system as case-sensitive, simply set this option to false.

bash
git config core.ignorecase false

Note that setting this option to false on a case-insensitive file system is generally not advisable. This can result in unexpected errors. For example, renaming files solely by altering letter case may cause Git to report false conflicts or generate duplicate files.

Documentation

From the git config documentation:

core.ignorecase

If set to true, this option enables various workarounds that allow Git to function better on case-insensitive file systems (e.g., FAT). For instance, if the directory listing shows makefile but Git expects Makefile, Git will assume it is the same file and continue to track it as Makefile.

The default value is false, but core.ignorecase is automatically detected and set to true (if applicable) when creating a repository via git-clone(1) or git-init(1).

2024年6月29日 12:07 回复

你的答案