Pirobits
  

Git on MacOS is case-insensitive

alberto avatar Alberto Sola · 3/17/2024 · 1 min

Working on a Mac, I rarely rename files in Git. That was until the other day when my application wouldn't compile after I renamed a file and I couldn't understand why. Let me explain.

The Problem

The default file system on MacOS is case insensitive. If you rename any file, you won't notice a problem. However, if you work with Git, you'll find that the files in the repository (which is usually on Linux, which is case sensitive) are different from the ones on your computer.

In my case, I could compile the project locally, both natively and with Docker. However, it wouldn't build on the CI, and it took me a few minutes to realize the problem.

The Solution

You can always create a case-insensitive partition on your Mac, but I prefer a faster solution:

  1. Be aware of the problem.
  2. Git has subcommands for managing files, such as git mv, which allows you to rename files safely.

Subscribe to the newsletter for more interesting curiosities like this one.

Did you find this article useful? Subscribe to my newsletter and take the first step to launch IT products faster. You will receive exclusive tips that will bring you closer to your goals.


Recent posts