01

Beyond 'final_v2'

Anyone who has saved files called report_final, report_final2 and report_final_really has invented a crude version control system. Software teams face the problem on a far larger scale: thousands of files, many people editing at once, and changes that may break something days later. Version control tools solve this by keeping a complete history of a project. Every time a developer saves a meaningful set of changes, the tool records exactly what changed, who did it, when and with what explanation. Any earlier version can be inspected or restored. The most widely used tool today is Git, and hosting services built around it store the code of millions of projects, from hobby apps to banking systems.

02

Commits and differences

The basic unit is the commit, a snapshot of the project at a moment in time, linked to the commit before it. Together they form a chain of history. Rather than reading whole files, developers usually look at differences, or diffs, which show only the lines added and removed between two versions. That makes it easy to see what a colleague changed or to find when a bug first appeared. Tools can even search history automatically, testing commits halfway between a good version and a bad one to pin down the change responsible. Each commit message should explain why a change was made, which becomes invaluable months later when nobody remembers the reasoning.

03

Branches and merges

Version control's real power is parallel work. A developer can create a branch, a separate line of history, to build a new feature or fix a bug while the main version stays stable. Others can do the same on their own branches. When the work is finished and reviewed, the branch is merged back, and the tool combines the changes automatically. Most of the time this works smoothly, because people usually edit different files or different parts of the same file. When two people change the same lines in different ways, the tool cannot guess which is right, so it reports a conflict and asks a human to decide. Teams often require colleagues to review changes before merging.

04

Fingerprints for history

Git identifies every commit by a hash, a fingerprint calculated from its contents and its history. Change a single character anywhere and the fingerprint changes completely, which makes tampering or corruption easy to detect. Git's traditional hashes are written as 40 hexadecimal characters, each one of 16 possible symbols. The number of possible fingerprints is therefore 16 multiplied by itself 40 times, which equals 2 to the power of 160, roughly 1.5 followed by 48 zeros. Two different commits accidentally sharing one is, for practical purposes, impossible. Newer versions of Git can also use a stronger hash function, because researchers have shown that deliberately engineered collisions in the original algorithm are achievable with enough computing power.

05

From central servers to everyone's laptop

Version control is older than most people assume. Bell Labs created SCCS in 1972, and later tools such as RCS, CVS and Subversion became standard. Those systems mostly relied on one central server holding the official history, which people connected to for each operation. In 2005 a licensing dispute ended the Linux kernel project's use of a commercial system called BitKeeper, and Linus Torvalds wrote Git as a replacement within weeks. Git is distributed: every developer's copy contains the full history, so work can continue offline and no single server is irreplaceable. Mercurial, a similar distributed tool, appeared the same year. Hosting platforms then added collaboration features such as code review and issue tracking.

06

What it is not

Git and the hosting platforms built on it are often confused, but Git is the underlying tool, which works perfectly well on a single laptop, while the platforms are services that store copies and add collaboration features. Version control is also not a complete backup strategy, although a remote copy helps. It works best with text files such as code, documentation and configuration, and handles large videos or design files less gracefully without extra tools. One common mistake is committing passwords or secret keys: because history is kept forever, deleting the file later does not remove it from earlier commits. Beyond software, writers, scientists and lawmakers in some countries now use the same tools to track documents.

FOLLOW THE EVIDENCE

Sources & further reading

Figures are rounded and widely published; check the linked organisations for the latest editions. These organisations do not endorse this website.