Since I watched the Ruby/JS WAT? video, I always see it in front of my eyes, whenever I discover my personal WATs in all parts of my life. And I always want to write about them, so here is one such thing.

I've found a bug in GIT.

How likely is that to happen? Give me any lottery you can think of and still I can argue if it's harder to win in it or find a bug in GIT. Still - it happened to me and the funniest thing is, that it happened while working on a blog application. When I worked on it alone!

No big teams, merges, overriding history... nothing. Just basic features had been used there.

Here is how it happened...

For people who don't know the word WAT: It's a term describing a thing that shouldn't have a place. Something completely unexpected and non-intuitive.

React blog application

I wanted to rewrite my blog from Nuxt (Vue.js) to Next (React.js) to test a very weird behavior related to the Nuxt API proxy.

During the development, I've realized, that I've named one of the component's files wrongly - Logo.js instead of logo.js. No big deal, one could say. Just rename it, commit changes and voila! You're ready to go.

However, not everything went so smoothly.

Module Not found

The continuous integration tool - in this case, it was a Now from Zeit company - reported that the path to my logo component could not be found.

I was stunned. Ok, I expected that I have a typo somewhere in the import or the file name, but I haven't.

My components file list was very small and flat, there was no place for an error:

Components file list in Driggl's blog application

The same applied to the importing part, where I just needed to import the file from the same folders, when I had just this one-line responsible for importing the Logo component:

import Logo from './logo'

The weirdest thing was that actually everything worked locally, and it only crashed when deploying to production.

I was really confused until I've shown the code to my teammate. He had cloned the repository and we've realized, that the logo component file is named wrongly despite the fact I had no uncommited changes!

GIT has issues.

It was a really interesting discovery, that when I've checked the GIT mechanism, it'd shown me that GIT does not recognize renaming files when the only change you do in the file name is the letter's capitalization!

So basically, even though I had the logo file renamed, GIT'd never noticed it! I was looking like:

And here I am - WAT?

Try it yourself:

touch something.txt
git add -A .
git status

Script 1

Then play with the file name a little bit:

mv something.txt Something.txt
git status

Has anything changed for you?

Now try to reset the staged changes and check the status again:

git reset
git status

Script 2

Voila! The GIT magically recognized the file name!


This little experience taught me that everybody writes buggy code sometimes. We should never assume anything is perfect, as every little part of the software we use is written by a human. And humans can make mistakes.

And, if it comes to GIT, just always - ALWAYS do the review of your own changes.

I occasionally write about GIT hacks and tricks, but this one was the most interesting thing I've found in the last few years.