Case Sensitive Git on a Mac like a Boss (APFS)
By default, MacOs uses a filesystem format that is not case sensitive APFS. That means that the directories a and A are essentially the same. This is a problem when working collaboratively with people using Linux or another case sensitive file system
By default, MacOs uses a filesystem format that is not case sensitive
APFS. That means that the directories
A are essentially the same. This is a problem when working collaboratively with people using Linux or another case sensitive file system.
Real world Example
Magento uses some wacky theory for storing product images when they are uploaded in case sensitive directories. So the following files would go into the respective directories.
abc.jpg => pub/media/catalog/product/a/b/abc.jpg aBc.jpg => pub/media/catalog/product/a/B/aBc.jpg Abc.jpg => pub/media/catalog/product/A/b/Abc.jpg
This may not be an issue if you are developing without using
Git or some other type of version control (like a maniac). In a collaborative environment where
Git is used, when you try to clone or pull the changes to the
catalog/product directory it will combine the directories and the site will not be able to find the correct product images.
The best solution is to use the
APFS (Case-sensitive) filesystem. On macOs Big Sur and later you can create a new volume in your "disk container" that is case sensitive without much hassle using
Disk Utility on the mac.
Next type a name for your new volume. I would suggest a name with NO spaces.
Thats it! The volume will automatically expand on an as needed basis. No need for allocating a chunk of your hard drive.
Move your project directory to the new case sensitive partition. For example if you use the
~/Sites directory for projects, you would issue the following command in the terminal.
$ mv ~/Sites /Volumes/Case\ Sensitive/
Create a symlink to the new case sensitive directory so you dont disrupt your workflow.
$ ln -nfs /Volumes/Case\ Sensitive/Sites/ ~/Sites