Chapter 1 Introduction

We’ll start by exploring how version control can be used to keep track of what one person did and when. Even if you aren’t collaborating with other people, automated version control is much better than a situation where we have multiple nearly-identical versions of the same document.

1.1 Overview

Version control systems start with a base version of the document and then save just the changes you made at each step of the way. You can think of it as a tape: if you rewind the tape and start at the base document, then you can play back each change and end up with your latest version.

Changes Are Saved Sequentially

Once you think of the changes as being separate from the document itself, you can then think about committing different sets of changes onto the base document and getting different versions of the document. For example, two users can make independent sets of changes relating to the same document, when they work on separate branches of the master document.

Different Versions Can be Saved

If there aren’t conflicts, you can even commit two sets of changes onto the same base document if the person who is responsible for making the commit is satisfied with both sets of changes. Alternatively, they may just want to commit the changes from one user and discard the other.

Multiple Versions Can be Merged

Hence, a version control system is a tool that keeps track of all these changes. It allows users to create different versions of various files, where a new version of the master document is created after a commit has been executed. The complete history of commits for a particular project and their metadata make up a repository and these repositories can be kept in sync across different computers facilitating collaboration among different people. All the metadata relating to each commit is stored so one can always roll back to a previous commit, whereupon one may decide to commit a different branch of the master document.