Version control is a backbone of professional software development. When you have a job as a software developer you'll use version control every single day, and it's a huge part of your role at work, so you need to know what it is and why you use it. A lot of time people are thrown into using version control whether at work or in a training course like this without a lot of background or core knowledge about it. But fortunately, version control is really easy to understand because it only does three things, and those three things are fundamental. First, it provides a safety net that lets you restore your work to a previously saved state. Version control lets you roll back time when you mess things up. And if you've ever written a term paper and you made changes to it that you later regret, you may understand why you'd want to return to a previous version. Version control can do that for you.
Here's number two: when you use version control you can collaborate. This lets you coordinate changes in a large group, and if you've ever worked on a group project and you've asked people for feedback, you probably get this one too because version control lets you handle uncoordinated changes from lots of people on a single projects, and it lets you bring those changes together to create a polished final result. The last thing is version control lets you try things out and work on them before you add them to your project whether it's a new feature or bug fix. It lets you see how things will work and what they look like before you commit to them. And version control is the ultimate try before you buy tool when it comes to software development. Okay, those are the three things version control does. And I'm gonna dive in a tiny bit deeper and look at each of these.
Version control safety net ensures you don't have to live with decisions you'll regret because software development is not like getting a haircut. When you get a bad haircut, the only way to deal with it is to cut off more hair or maybe try parting it on the other side or something like that. But, software doesn't naturally grow back over time so you cannot get out of your messes that way, you need a better way to fix things when your code goes south, and I assure you it always does.
What version control does is it lets you save your work over time. It keeps a record of your changes so you can see those changes and, if you have to, revert to them. This will effectively let you travel back in time for example and undo that bad decision where you accidentally kept your dad from dating your mom then you started dissolving because you and your siblings were never born.
Say you were working on a project, you made snapshots of your project to save it at four different times. Everything was fine the first time you saved your project. And the second. And the third, no wait let's say you made a really subtle mistake here and it's one that you're not going to catch for a little bit. There's actually something here that you shouldn't have done but you don't know that yet, so you go ahead and you make yet another change and save it. So version control offers several approaches to the situation. You could move back in time to snapshot two, and that would lose the bug from snapshot three, and the changes from your newest snapshot. Or you can interactively toss away snapshot three and merge the changes from your newest snapshot.
Now, it's a little annoying to do this but the mechanisms are in place to save your project if you're willing to learn how to do it. I'm not gonna go into the details but this is possible with version control. In contrast, if you notice a problem right away, rolling back changes is really painless, you just reset to the latest snapshot and you can just continue where you were. You can restore the files to exactly how they were just before you saved, or you can reset everything to your latest save point discarding all changes that happened after that. Version control gives you the nuance you need to restore or discard work exactly how you need to.
The second major future version control is collaboration. Version control lets you work with many people at once. Version control lets you pick and choose changes from your coworkers so you can decide exactly how you want to update your project. This approach lets people work independently all on the same project, and it even lets them propose different implementations of the same feature just like the two co-workers at the bottom who both basically implemented potato chips.
The last big great feature of version control is that it lets you explore and try things out without messing up the project for anyone else. You never wanna try out new features on your master branch, it makes people cranky and can break the project that is funding your paycheck. But, you do need a way to fix bugs and implement new features. And you do need to share this with other people on your team to get feedback and design critiques. So you use a feature called branching, and what that does is it lets you create safe alternative versions of your project, and that don't mess up your main build and the branches won't get your co-workers angry or kill your performance reviews or anything like that.
When you branch a project it works just like the rest of version control but it creates a separate and safe environment where you can design new features and test out your ideas. Branches isolate you so you can work safely without destroying your build. Once you finish developing and testing your new feature or working on your bug fix, you can safely merge that change from your branch back to the master.
So there you have it. These are the three things that version control does for you. When you use version control, you create a safety net that lets you back away from mistakes. You create a platform that lets you work in a group, and make changes that are thoughtful and coordinated. And finally, version control lets you create branches so you can develop new features and fix bugs without putting your main project in danger. Safety, coordination, and developing new things. These are the key features of version control.