Jack Hamilton

2016/01/04: Version Control:Why You Need It Before The Sun Comes Up!

When I was a young sophomore in high school, I pulled an all-nighter writing, editing and finalizing a journalism assignment for my high school newspaper. By the time the sun came up that early morning, I was a zombie and in my half-asleep state somehow managed to accidentally overwrite my file. To my horror, all the night's work was lost. And this wasn't even a case of not saving my work. I DID save my work. But there was no safety net to allow me to recover my work from just a few minutes before I overwrote my file. If only I could go back in time just 30 minutes!

source control image

When I was much older I was updating a peace of code with two new features. I got one feature working perfectly. Feeling a sense of "flow", I felt I was unstoppable and continued to code the second feature request without making a backup of the working code that had the first feature all done. Hours later I realized that the new (second) feature was not working correctly as I'd hoped, and I wasn't going to have the second feature debugged any time soon. Meanwhile my employer wanted at least the first feature (that was ready just hours ago!) to go off to be tested in the User Acceptance Test--feature #2 could wait. Unfortunately feature #2 broke all of the code, making feature #1 unuseable until I got feature #2 either removed or debugged completely. If only I had not been so eager and had made a backup RIGHT AFTER feature #1 was completed.

Both of these real-world scenarios would have benefited from source control. In both situations, copies of the work could have been saved off periodically throughout the work-effort, creating checkpoints in time. In the first scenario, the moment I overwrote the final copy, I could have gone to my version control system and requested the last checked-in copy, meaning I would have probably just lost maybe only 1 hours worth of work instead of the entire night. In the latter scenario, I could have extracted a copy of the source code immediately before I started working on feature #2, allowing my team to start downstream testing feature #1.

Git is one of these version control systems. It allows you to keep snapshots in time of your work. It saves the incremental changes to a repository on your local computer. For added safety (as well as ease of collaberation with others), you can have the work uploaded to a third-party central cloud server called GitHub. That way if you happen to also lose your PC harddrive or perhaps laptop all together, your work (and all its incremental pieces) can be re-downloaded from the cloud.

Obviously this was just a VERY high level simplistic, single case-study (actually two) of a good reason to use Git, GitHub and version control, but I think it gets the point across. For more information, start at this Git website.

Hope This Helps,

-- JLH