Revision control is the process of managing multiple versions of a piece of information. In its simplest form, this is something that many people do by hand: every time you modify a file, save it under a new name that contains a number, each one higher than the number of the preceding version.
Manually managing multiple versions of even a single file is an error-prone task, though, so software tools to help automate this process have long been available. The earliest automated revision control tools were intended to help a single user to manage revisions of a single file. Over the past few decades, the scope of revision control tools has expanded greatly; they now manage multiple files, and help multiple people to work together. The best modern revision control tools have no problem coping with thousands of people working together on projects that consist of hundreds of thousands of files.
The arrival of distributed revision control is relatively recent, and so far this new field has grown due to people’s willingness to explore ill-charted territory.
I am writing a book about distributed revision control because I believe that it is an important subject that deserves a field guide. I chose to write about Mercurial because it is the easiest tool to learn the terrain with, and yet it scales to the demands of real, challenging environments where many other revision control tools buckle.
There are a number of reasons why you or your team might want to use an automated revision control tool for a project:
It will track the history and evolution of your project, so you don’t have to. For every change, you’ll have a log of who made it; why they made it; when they made it; and what the change was.
When you’re working with other people, revision control software makes it easier for you to collaborate. For example, when people more or less simultaneously make potentially incompatible changes, the software will help you to identify and resolve those conflicts.
It can help you to recover from mistakes. If you make a change that later turns out to be in error, you can revert to an earlier version of one or more files. In fact, a really good revision control tool will even help you to efficiently figure out exactly when a problem was introduced (see Finding the Source of a Bug for details).
It will help you to work simultaneously on, and manage the drift between, multiple versions of your project.
Most of these reasons are equally valid—at least in theory—whether you’re working on a project by yourself, or with a hundred other people.
A key question about the practicality of revision control at these two different scales (“lone hacker” and “huge team”) is how its benefits compare to its costs. A revision control tool that’s difficult to understand or use is going to impose a high cost.
A 500 person project is likely to collapse under its own weight almost immediately without a revision control tool and process. In this case, the cost of using revision control might hardly seem worth considering, since without it, failure is almost guaranteed.
On the other hand, a one-person “quick hack” might seem like a poor place to use a revision control tool, because surely the cost of using one must be close to the overall cost of the project. Right?
Mercurial uniquely supports both of these scales of development. You can learn the basics in just a few minutes, and due to its low overhead, you can apply revision control to the smallest of projects with ease. Its simplicity means you won’t have a lot of abstruse concepts or command sequences competing for mental space with whatever you’re really trying to do. At the same time, Mercurial’s high performance and peer-to-peer nature let you scale painlessly to handle large projects.
No revision control tool can rescue a poorly run project, but a good choice of tools can make a huge difference to the fluidity with which you can work on a project.
Revision control is a diverse field, so much so that it is referred to by many names and acronyms. Here are a few of the more common variations you’ll encounter:
Some people claim that these terms actually have different meanings, but in practice they overlap so much that there’s no agreed-upon or even useful way to tease them apart.
Get Mercurial: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.