How Git & Github saved my A**
Updated on Oct. 8, 2017 |
Today morning, I suddenly figured out that one of the admin forms is not working in the personal project I am currently working on. I tried again and again for having a solution. I thought it was due to sqlite DB locked status. Then I tried shipping into MySQL but no result was gained. After a while, I figured out that I am completely messed up with the source code trying this and that. Luckily, I have been regularly committing all the changes into Git and Github which was helping me to go back to the last commit. There were situations I completely deleted migration folders and other important files which is something one rarely dares to do.
It was heartbreaking while not finding the solutions. Later I was dumbfounded and asked myself “Why don’t I checkout every commit into the log and keep looking for the last commit which was correctly working with the admin form?” Sh*t! I just have wasted these whole lot of minutes in finding this! I felt disgusted but was charmed as I figured out what was going on with the form. I found the last commit which was working good and then I did check the differences between last two commits, from which, one was working, another wasn’t (git command: git diff <working commit id> <not working commit id>). Shockingly, I discovered that I had done a silly mistake of missing indention and not returning a value in the form saving function! Good that I found this but the better that I just have used git diff for the first time to make a correction for a mistake which was life threatening to me!
Some lessons which I have learned from this mistake!
- Do commit small changes always! It might be daunting but lifesaving!
- Use git diff for checking bugs into previous commits and save thousands of your valuable minutes!
- Spend a bit time of yours in checking out the features provided by Git.
Life is awesome with Git. Hail, Git!