How do I commit case-sensitive only filename changes in Git?

前端 未结 16 2317
我在风中等你
我在风中等你 2020-11-22 03:31

I have changed a few files name by de-capitalize the first letter, as in Name.jpg to name.jpg. Git does not recognize this changes and I had to de

16条回答
  •  别那么骄傲
    2020-11-22 03:59

    Git has a configuration setting that tells it whether to be case sensitive or insensitive: core.ignorecase. To tell Git to be case-senstive, simply set this setting to false:

    git config core.ignorecase false
    

    Documentation

    From the git config documentation:

    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 probe and set core.ignorecase true if appropriate when the repository is created.

    Case-insensitive file-systems

    The two most popular operating systems that have case-insensitive file systems that I know of are

    • Windows
    • OS X

提交回复
热议问题