Archives
- Newer posts
- April 2024
- November 2023
- October 2023
- August 2023
- May 2023
- February 2023
- October 2022
- August 2022
- July 2022
- May 2022
- April 2022
- March 2022
- February 2022
- June 2020
- March 2020
- February 2020
- January 2020
- December 2019
- November 2019
- October 2019
- September 2019
- August 2019
- July 2019
- June 2019
- May 2019
- April 2019
- March 2019
- February 2019
- January 2019
- December 2018
- November 2018
- October 2018
- September 2018
- August 2018
- July 2018
- June 2018
- May 2018
- April 2018
- March 2018
- February 2018
- January 2018
- December 2017
- November 2017
- October 2017
- September 2017
- August 2017
- July 2017
- June 2017
- May 2017
- April 2017
- March 2017
- February 2017
- January 2017
- August 2016
- June 2016
- April 2016
- March 2016
- February 2016
- January 2016
- July 2015
- June 2015
- Older posts
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.