Git for BIG and small

Ryan Klarhölter
Marc O’Polo Digital Intelligence
2 min readApr 25, 2022

By Ryan Klarhölter, Fullstack Developer

Source: https://unsplash.com/photos/azA1hLbjBBo

The Git setting “core.ignoreCase” is automatically set, depending on the operating system. The setting should not be changed. When renaming files, use “git-mv” to be on the safe side to maintain a clean history and to prevent trouble on case-insensitive systems.

Git is case-sensitive. It perceives the renaming of the file “abc.txt” to “ABC.TXT” as a change. Both files could even exist next to each other. This is not a problem for case-sensitive file systems, which are common for Unix-like operating systems. macOS and Windows, however, are case-insensitive by default.

Git is smart enough to handle such situations. By running “init” or “clone”, the “ignoreCase” setting is automatically activated on such systems. If Git didn’t do that, the following would happen on case-insensitive file systems:

The renaming of “abc.txt” to “ABC.TXT” would be done successfully by the operating system. But Git would not see any change to the file “abc.txt”, but detects a new file instead: “ABC.TXT”.

The user of a case-insensitive system therefore might not even notice that he is suddenly checking two quasi-identically named files into the repo. When someone on a case-sensitive system does a checkout, they see two files: “abc.txt” and “ABC.TXT”. (They would also be able to see both files in Bitbucket.)

It gets really stupid when you try to checkout such commits — which introduce two files with the same name — on case-insensitive systems: It doesn’t work, because Git is simply not able to create two files with the same name on case-insensitive file systems.

The easiest way to solve such a situation is to rename the files on a case-sensitive system or via Bitbucket’s web interface.

You want to shape the digital future of the fashion industry? Start creating with us. The Digital Intelligence & Tech Teams at Marc O’Polo are always looking for talented and driven software engineers, data engineers, data scientists, data analysts, ML Engineers or project managers to join our team. Learn about life at Marc O’Polo and visit our career site.

--

--