Version control
Record every change to the code as a commit, so anyone can see who changed what, when and why, and get any earlier version back.
1 technology on this page ↓How it works
A version control system keeps a repository: the full history of a project as a chain of commits. Each commit is a snapshot of the files plus who made it, when, a message saying why, and a pointer to the commit before it. A branch is a named line of commits, so people can work on separate changes at once; a merge joins two branches back together, and the tool combines the edits automatically unless two people changed the same lines (a conflict a person must resolve). Older, centralized systems such as CVS, Subversion and Perforce keep the history on one server and clients check files out from it. Distributed systems such as Git and Mercurial give every clone the whole history, so commits, branches and logs work offline, and every clone is a backup. Teams still agree on one shared copy, usually on a host like GitHub, GitLab or Bitbucket, where changes arrive as pull requests (GitLab calls them merge requests) that others review and that automated checks test before they are merged. Some organizations keep all their code in one repository (a monorepo), which makes changes that span many projects atomic but needs special tooling at scale; others give each service its own repository (polyrepo), which is simpler per project, but a change that spans several repositories needs several coordinated pull requests.
A lab notebook where every entry is dated and signed and pages are never torn out, and anyone can photocopy the whole book to work on at home and send their new pages back.
Reach for it when
- Always, for source code, infrastructure definitions, configuration and documentation
- Several people change the same codebase and need to review and merge each other’s work
- You need to know which change broke something, and roll it back
Think twice when
- Storing large binaries, datasets or build outputs directly in Git; use Git LFS, an artifact registry or object storage
- Committing secrets: anything pushed stays in the history even after a later commit deletes it
A real example
A five-person team keeps a web app in one Git repository on GitHub. A developer creates the branch fix-login-timeout, makes two commits on a train with no network, and pushes when back online. She opens a pull request; CI runs 400 tests in four minutes and a teammate approves it. A week later a bug report points at login, and git log and git blame show exactly which commit touched that line and why.
More on version control
Narrower ideas that build on this one.
- Branching strategiesA team’s rules for how changes flow into the shared code and out to releases: which branches exist, how long they live, and how they get merged.
- Commit conventionsShared rules for what goes into one commit and how its message is written, so the history explains itself and tools can read it.
Technologies
Specific products, and what each does differently.
| Open source | The Git project (Software Freedom Conservancy) | GPLv2 | 2026-10-06 |
What each provider calls it
- AWS
- AWS CodeCommit (Git); closed to new customers from July 2024, open again since November 2025
- Google Cloud
- Secure Source Manager; Cloud Source Repositories, closed to new customers since June 2024
- Azure
- Azure Repos (Git, or TFVC for centralized version control)
- Open source & others
- Git, Mercurial, Subversion; self-hosted forges Gitea (MIT), Forgejo (GPLv3+) and GitLab CE (MIT); hosted GitHub, GitLab.com, Bitbucket; code review with Gerrit
Centralized or distributed#
Both models track commits and branches; they differ in where the history lives and what that makes cheap.
| Centralized (Subversion, Perforce, TFVC) | Distributed (Git, Mercurial) | |
|---|---|---|
| Where history lives | On one server; clients hold a working copy | In every clone; one copy is the agreed shared one |
| Offline work | Commits, logs and diffs against history need the server | Commit, branch, log and diff locally |
| Branches | A copy of a directory, made on the server | A pointer to a commit, created nearly instantly |
| Access control | Per path: Subversion can grant read or write on a single directory | Per repository: anyone who can read gets the whole history |
| Binary files | Subversion’s locking stops two people editing an unmergeable image at once | Needs an add-on such as Git LFS for large files |
| Failure mode | The server is a single point of failure | Every clone is a full backup |
In code · bash
git clone https://github.com/acme/shop.git && cd shop
git switch -c fix-login-timeout # a new branch from main
# edit files, then record the change
git add src/session.ts
git commit -m "Extend login session timeout to 30 minutes"
git push -u origin fix-login-timeout # share it, then open a pull request
git log --oneline -3 # history, newest first
git blame src/session.ts # which commit last changed each lineOften confused with
Where it came from1972–2024
Version control started at Bell Labs. In 1972 Marc Rochkind began the Source Code Control System (SCCS), which stored each file’s changes as deltas so any earlier version could be rebuilt. In the early 1980s Walter Tichy at Purdue wrote RCS, which also stored revisions as deltas and, like SCCS, expected people to lock a file before editing it. In 1986 Dick Grune posted the shell scripts that became CVS, which let several people edit their own copies of a set of directories at once and merged their changes afterwards; two years later Brian Berliner rewrote it in C, and it spread widely.
By 2000 CVS’s limits were obvious to CollabNet, which hired developers to write a replacement that kept the basic ideas of CVS “but without the bugs and misfeatures”. Subversion hosted its own code from August 2001. It stayed centralized: one server held the history. Meanwhile the Linux kernel, which had passed patches around by email for a decade, adopted the proprietary distributed tool BitKeeper in 2002. In April 2005 the arrangement broke down and its free licence was withdrawn, and Linus Torvalds wrote that he would have to find an alternative.
He made the first commit of Git on April 7, 2005, and the kernel moved to it nine days later; Matt Mackall announced Mercurial the same month with similar goals. Git handed every developer the full history and made branches nearly free. Hosts such as GitHub, which opened in April 2008, built review around the pull request: a page for discussing a branch before it is merged. By 2022, 94% of respondents to Stack Overflow’s developer survey used Git.
Why it’s built this way
- Copy, modify, merge instead of lock, modify, unlock
- SCCS and RCS made people lock a file before changing it, which serialized work. CVS let everyone edit their own copy and merged the results, betting that real conflicts are rare. Almost every system since has made the same bet, and kept locking only for binary files.
- Every clone holds the full history
- With BitKeeper, Torvalds wrote, the people around him had a much easier time merging with his tree and sending him theirs. Git and Mercurial kept that model: everyone has a full repository, works offline, and no single server’s loss means losing history.
- Make branches cheap
- In Subversion a branch is a copy of a directory made on the server. In Git a branch is a small file holding the hash of a commit, so creating or switching one is nearly instant, and a short-lived branch for every change became normal.
- Review before merge
- Google’s internal Mondrian tool, and later Rietveld, Gerrit and GitHub’s pull requests, made a second pair of eyes a step in the workflow rather than an afterthought. Hosts can now require approvals and passing checks before a branch may be merged.
Timeline
- 1972
Marc Rochkind starts SCCS at Bell Labs
- 1986
Dick Grune posts the CVS shell scripts
- 2001
Subversion becomes self-hosting on August 31
- 2002
The Linux kernel moves to BitKeeper
- 2005
BitKeeper split in April; Git’s first commit on April 7; Mercurial announced
- 2008
GitHub opens to the public on April 10
- 2024
Google and AWS stop taking new customers for their Git hosting; AWS reverses course in November 2025
- Marc J. Rochkind: The Source Code Control System, IEEE Transactions on Software Engineering (Dec 1975)
- TUHS comp.unix.programmer: SCCS revision history (1972 prototype, Rochkind; RCS by Tichy, 1982)
- Walter F. Tichy: RCS, A System for Version Control, Purdue technical report (Mar 1984)
- Dick Grune: Concurrent Versions System CVS, with early history
- Version Control with Subversion: What is Subversion? (history, CollabNet, self-hosting)
- Pro Git: A Short History of Git (BitKeeper, 2002 to 2005)
- Linus Torvalds on LKML: Kernel SCM saga.. (Apr 6, 2005)
- git/git on GitHub: Initial revision of “git” (Apr 7, 2005)
- torvalds/linux on GitHub: Linux-2.6.12-rc2, the initial git repository build (Apr 16, 2005)
- Matt Mackall on LKML: Mercurial v0.1, a minimal scalable distributed SCM (Apr 2005)
- GitHub blog: We Launched (Apr 10, 2008)
- Gerrit Code Review: Gerrit’s history (Mondrian, Rietveld)
- Stack Overflow Developer Survey 2022: Version control systems
- Google Cloud: Cloud Source Repositories release notes (end of sale, June 17, 2024)
- AWS DevOps Blog: AWS CodeCommit returns to general availability (Nov 24, 2025)
Sources21
- Pro Git: About Version Control (centralized and distributed systems)
- Pro Git: Branches in a Nutshell (a branch is a movable pointer)
- Version Control with Subversion: Path-Based Authorization
- Version Control with Subversion: Locking
- Version Control with Subversion: Using Branches (a branch is a copy)
- GitHub Docs: Removing sensitive data from a repository (it stays in history)
- Git LFS: replaces large files with text pointers
- GitHub Docs: About pull requests
- GitHub Docs: About protected branches (required reviews and status checks)
- GitLab Docs: Merge requests
- Bitbucket Cloud docs: Create a pull request
- Potvin and Levenberg: Why Google Stores Billions of Lines of Code in a Single Repository (CACM 2016)
- AWS CodeCommit User Guide: What is AWS CodeCommit?
- AWS CodeCommit User Guide: Document history (closed to new customers Jul 25, 2024; open again Nov 25, 2025)
- Google Cloud: Cloud Source Repositories release notes (not available to new customers since June 17, 2024)
- Google Cloud: Secure Source Manager overview
- Microsoft Learn: What is Azure Repos? (Git and TFVC)
- go-gitea/gitea on GitHub: LICENSE (MIT)
- Forgejo FAQ: licensed under GPL v3+ since v9.0
- Forgejo: Comparison with Gitea (created October 2022, hard fork in 2024)
- GitLab on GitLab.com: LICENSE (MIT Expat outside the ee/ directory)