Set ignorecase
to false
in git config
As the original post is about "Changing capitalization of filenames in Git":
If you are trying to change capitalisation of a filename in your project, you do not need to force rename it from Git. IMO, I would rather change the capitalisation from my IDE/editor and make sure that I configure Git properly to pick up the renaming.
By default, a Git template is set to ignore case (Git case insensitive). To verify you have the default template, use --get
to retrieve the value for a specified key. Use --local
and --global
to indicate to Git whether to pick up a configuration key-value from your local Git repository configuration or global one. As an example, if you want to lookup your global key core.ignorecase
:
git config --global --get core.ignorecase
If this returns true
, make sure to set it as:
git config --global core.ignorecase false
(Make sure you have proper permissions to change global.)
And there you have it; now your Git installation would not ignore capitalisations and treat them as changes.
As a suggestion, if you are working on multi-language projects and you feel not all projects should be treated as case-sensitive by Git, just update the local core.ignorecase
file.
git mv myfile foo; git mv foo MyFile
– toniogit mv hello.txt Hello.txt
will work on case insensitive OS. See my answer below – VonC