Pirobits
  

Git on MacOS is case-insensitive

alberto avatar Alberto Sola · 3/17/2024

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?Join the community to receive exclusive content!

Learn about product creation and software development

Exclusive Content

Transformative Knowledge

I write in-depth articles about software development and product creation.

Real Experience

I share what I learn in my day-to-day work as a software engineer and tech lead.

Straight to the Point

I value your time and send you, at most, one email a week with a summary of the most important news.

Would you like to join?

I value your privacy, I only send quality content.

We are already more than 50 professionals

The most recent posts I wrote in the blog