Understanding Version Control Systems

Learn how to use the version control system Git to manage our code.

What is a version control system?

A version control system (VCS) is used to manage changes in documents, computer programs, or other collections of files. They’re used by programmers to manage different revisions of their code. It’s possible to restore earlier reversions if needed. This makes it safer to edit files, because we’ll always have a way for us to restore what we had if we decide that the changes we made need to be reset.

A VCS is also used so that developers can work together on the same project and, in a safe manner, work in the same source code files. Version control systems also keep track of who changed what in a document, and when the change was made. Files that are version controlled are stored in what is called a repository. When changes are made to a file, the user of the VCS can commit these changes to the repository, and by extension of that, create a reversion point. It’s at these points where the version control system takes a snapshot of all the changes made.

To illustrate how this works, we can use one of the most popular version control systems available, known as Git. Git was created by Linus Torvalds, the creator of Linux, in 2005. It was initially created to be used by the programmers who were working on the Linux kernel code, but soon gained popularity outside of the Linux project. Today, it’s by far the most popular version control system.

How Git works

Let’s start by writing some code. Let’s say we have this code in a file called calc.code:

Get hands-on with 1200+ tech skills courses.