My team currently manages a git repo across multiple filesystems. Most of us use Windows, but some of us use Linux. Plus, we deploy our production code on a Linux server. This has led to multiple issues with the casing of filenames in our codebase (ie. importing Foo.js when the file is actually foo.js). Recently, I completed a cleanup on our project folder that consisted mostly of re-organizing our directories and renaming our directories/files to a common naming standard. A lot of those filename changes were changing the case of the file (e.g. foo.js -> Foo.js).
I was not fully aware of how git handles filenames differently on case-sensitive vs case-insensitive filesystems when I was making these changes and it resulted in a lot of weird errors. One thing that I came across when researching this was the ignorecase value in .gitconfig.
From the git-config documentation:
Internal variable which enables various workarounds to enable Git to work better on filesystems that are not case sensitive, like APFS, HFS+, FAT, NTFS, etc. 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".
…
Git relies on the proper configuration of this variable for your operating and file system. Modifying this value may result in unexpected behavior.
From what I'm able to understand from this, setting ignorecase = true will make it so that if git detects the same file name but with different casing, it will change the name in the git index to match what is on the filesystem (i.e. if Windows has foo.js and a git checkout/pull has Foo.js, it will assume that foo.js is correct and git will use that casing). My concern with that is what will happen if I push to remote and our deployment server picks up the change. It will then try to import Foo.js which doesn't exist and error out.
However, by setting ignorecase = false, then git should be able to detect that there is a difference in the filenames and properly replace the files. Is this correct, and should I have my team set this value to false because we work across different filesystems?
I've read posts where people say that you should absolutely do this, and some posts that say the exact opposite.