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.

React blog application

I wanted to rewrite my blog from Nuxt (Vue.js) to Next (React.js). 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!

However, not everything went so smoothly.

Module Not found

The continuous integration tool 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.

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!

Try it yourself:

touch something.txt
git add -A .
git status
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

Voila! The GIT magically recognized the file name!

Takeaways

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.