Git
Mistakes I Made in GIT

I can still remember that day as if it was yesterday. It was one of the worst days of my entire development career. The D-day, deadline of my module, and we were still fixing the bugs. At the same time, the client was sending n number of emails asking for the updates. I had no answer to his emails as my mind was fully engrossed in figuring out the problems and solving them. It was a really stressful situation. The project was on GIT, the most essential tool for all the developers, as it keeps our code history in check and helps us in understanding every bit of our code change. Instead of making things easier for me, it became a nightmare because of one mistake.

I admit not being an expert in GIT, but I do know some of its basic usage which I use every day like git pull, git push, git merge, git rebase. In GIT, we work with branches. The important branch is the master branch which also is the production branch, the one should never ever be touched. You can say one of the least updated branches, that too when everything has been tested and works as expected on the development branch.

The next branch is the development branch. You do not code here, but mostly do pull, push and check if everything is proper and it can be uploaded to the live site. You can say the development branch is like a blueprint. When you are working in teams, the development branch becomes very important. It allows you to check your changes and changes made by others before merging the code with the master branch. So from the development branch, we branch out and create our new working branch where we write our code and test if everything works fine.

Coming back to my mistake… after we had pushed our changes to the development branch everything was working perfectly fine. Then we merged that branch with the master branch. Then Huh?!? The module stopped working on the live site. I did not know what was going on and what to do since everything was working on the development branch. There was no way to track the issue.

As I had to upload the changes to the live site, I directly jumped to the master branch, breaking the important rule of NOT touching the master branch. Then somehow by doing some hotfixes, I managed to get the live site working. At that moment, getting the live site working was THE most important thing. Now to get my development branch at par with the master, I merged the development branch with the master branch. Just as I did this, everything started to go haywire on the development site. Having inadequate knowledge about GIT, I had completely stopped using the development branch and worked directly on the master branch. BIG MISTAKE!! To add to my misery, both branches went off in different directions.

In the end, I had to sit with one of our directors, who excels at working with GIT, and fix the mess that I had caused. With this experience, the one most important thing I learned is, never ever merge development branch with the master branch. Only backward master with the development. Whoever reads this, keep that in mind and don’t repeat my mistake.

Sabina Colaco

Post Comments

* marked fields are mandatory.