From the course: Git from Scratch
Why use version control? - Git Tutorial
From the course: Git from Scratch
Why use version control?
- [Narrator] Why use version control? It's an important question to answer and it's worth asking because on the face of it, version control looks like adding some very complicated stuff on top of already complicated coding work. Here's my answer. Version control is a way of adding all the coolest and most outlandish tools and features of science fiction into our coding and development process. Say what now? Let me explain. You're working on a project and you want to add a feature, but adding that feature means making huge changes to your code and you're not sure if it'll work or not. So you make a copy of your code and start making changes to that copy. Then you realize you need to add a feature to your feature, which, again, requires huge changes, so you make another copy of your copy. This gets confusing very quickly. Then, after working on your code for hours, building out functions, adding features, tweaking outputs, you realize you made a mistake somewhere and that mistake now impacts everything you did after that point and is present in all your different copies. If only you could go back in time, fix that mistake, and then just keep working. With version control, you can. As you build out your project, you use a version control system like Git to take snapshots of your work that you can return to at any time. You can also make branches, effectively, alternate timelines of your work to add features or experiments, and then switch between those timelines as you work. If a feature in one branch is successful, you can merge it to the code in another branch. Or if it's not successful, simply discard it and move forward as if nothing happened. With version control, time travel, alternate timelines, rewriting history, all these cool science fiction ideas become reality. And all these cool science fiction ideas help you be more efficient at building, debugging, and deploying code. So why use version control? Because it gives your coding practice sci-fi powers.