Version Control
So let’s talk about version control in its simplest form.
Let’s say that I create a new code file and I write a few lines in it.
Now I decide to put it under version control using Git and let’s say that I call this savepoint number 1, now this is my first version. So later on as I progress I write maybe a few more lines of code.
And at this point, I decide to make another save point and I call this my second version.
So further down the line I accidentally screw up my entire code file and it’s irreparable and I get to the point where I would rather burn my entire code file rather than having to try and fix it.
You do get into these situations because very often your code is interlinked and each class depends on another and sometimes you can screw up in a way where you know all hope is lost and I simply just want to roll back to the last save point.
I can do that using Git.
I can do that using other tools as well but the most popular tool and the one that we’re going to be talking about is Git.
So you can either compare your current code file to the current mess that you’ve made against a previous version so that any of the save points before.
Alternatively, you can simply just roll back to a previous version and it doesn’t have to be the one that was immediately previous.
You can go as far back or as far forwards as you like as long as you know which version you want.