Have you ever made changes to your site that didn’t quite work and then couldn’t remember what you did and painstakingly had to figure it all out again?
Or, have you wanted to go back to an older version of your website or WordPress theme but didn’t have any backup?
Version control is the safety net for cases like that. It is a system that tracks changes to one or several files and stores information on who changed what at which point in time.
That way it allows you to revert your website or project back to previous versions (hence the name) and keep an overview over what has happened to your files through time.
One of the most important things is of course teamwork. It allows you to work in teams. So if you’re using Git, each team member can work on different features, they can collaborate on the same features, they can see who changed what, and they can also blame each other because they, all of sudden then can prove who added the line of code to index.php in 2011, or whatever.
Even if you’re not working in a team, using Git gives you a lot of control. You’ve probably been in the situation where you had a WordPress plugin or WordPress theme, and you were working on some kind of feature on it, and then someone finds a bug that you need to fix immediately. So what do you do, do you remove the stuff you already added, or do you just keep it in there, while you make the bug fix. If you are using Git you could just have the new feature on its own branch, and then you could just fix the bug on the master branch, and you wouldn’t have to really deal with the conflicts between the bug fix, and the new stuff you’re working on that’s not really done yet, and ready to be released.
Then of course, if you’re using Git, it’s really easy to have a backup of your code because you can basically just push it to GitHub, or Bitbucket, or GitLab, or one of the other hosted Git repository services that’s out there.
Lastly it makes deployments a lot easier. You can set up automated deployments, so whenever you release a new feature and you tag it in Git, it can be released to your clients servers or the users of your plugin.