A two color illustration of an old radio with two knobs and a dial in red and black surrounded in a red halftone pattern. The dial goes back and forth when hovered.

Case-insensitive Git

Changing the case of a file on macOS or Windows won’t be recognized by Git. git mv MY-FILE.txt my-file.txt can be used to tell Git it changed. On Linux, which is case-sensitive, Git does recognize the change. How did I learn this?

I was building an Astro component to dynamically render SVG components. It’s passed an SVG’s filename as a string, gets all the SVGs as components, finds the right one if it exists, then returns an SVG component — I’m oversimplifying things, it does more.

When I deployed to Netlify, two SVGs weren’t showing. My work wasn’t complete when I deployed because I wanted to show a coworker what I was working on. I figured I did something silly. Scrolling through the deployment log, I saw Cound not find "my-file.svg". But, it was there. I thanked myself for including an error message and got to work.

I cleaned up the code, added some more error handling, nitpicked, then redeployed. The two SVGs still weren’t showing. “I don’t like that”, I muttered.

In the component, I temporarily added a console.log() to print all the SVGs that were being found, and redeployed. After the deployment finished, I scrolled through the long log, and found where all the SVG names were being dumped. I didn’t notice right away, but then I saw My-File.svg in the array of SVGs. Locally, the filename was my-file.svg. That’s it!

I went into the markdown file that set the SVG name in its frontmatter, and changed it to all caps. Now, locally, the SVG wasn’t loading because it was looking for the file in all caps. I found the file, changed it to all caps, then staged the fi… there wasn’t an SVG to stage. I was confused, but then realized Git wasn’t case-sensitive. For kicks, I tried it on Linux, since that’s what Netlify uses, and it did recognize the case change. It all made sense now.

I changed the filenames back to their original names, then ran git mv File-Name.svg file-name.svg on each one — there were only two, so no need for a Bash script. I deployed again, and was relieved to see all the SVGs were there. Finally.

What happened is I changed my mind on the naming convention of SVGs. At the same time, I was adding more SVGs. I didn’t notice the renamed files weren’t being committed because of all the other SVG noise.

I was reminded of a few things. If the case changes had been separate commits, I would have noticed. Error handling is a good friend. And, of course, I should have written tests in Vitest and Playwright from the start.


I know there’s a way to configure case sensitivity locally, but I would rather not do that. It seems like it could make a mess when working with others, always think about other people. In addition, I know there are multiple puns available to use in this post, but I will not use them. I don’t like puns. Lastly, this is really long, but I’m trying to get better at writing.

A piece of cat hair stuck on your screen that you can’t wipe off