Explainer
How version control works: commits, branches and Git
Version control is a system that records changes to a file or set of files over time so that specific versions can be recalled later.[1] Centralized systems keep the history on one server, while distributed systems such as Git give every user a full copy of the repository and its history.[2][3] Git, created in 2005 for Linux kernel development, stores each commit as a checksummed snapshot and treats a branch as a lightweight pointer, which makes branching nearly instantaneous.[4][5][6][7]
This page explains the ideas behind version control using Git, the system described in its official book, Pro Git. Hosting services built on Git are not covered here.
What version control does
Pro Git, Git’s official book, defines version control as a system that records changes to a file or set of files over time so that specific versions can be recalled later.[1] The book notes that it works not only for source code but with nearly any type of file on a computer.[1]
Centralized and distributed systems
Centralized version control systems, such as CVS, Subversion and Perforce, keep all versioned files on a single server that clients work from.[2] The obvious weakness is that the server is a single point of failure.[2]
In a distributed system such as Git or Mercurial, each client mirrors the entire repository, including its full history, rather than just the latest files.[3] If a shared server fails, any client’s copy can be used to restore it, because every clone is a full backup.[3] Most Git operations need only local files, with no information needed from another computer on the network.[8]
How Git records history
Git was created in 2005 by the Linux kernel community, led by Linus Torvalds, after the kernel project lost free use of BitKeeper, the proprietary system it had used since 2002.[4] Its design goals included speed, a simple design, strong support for thousands of parallel branches, being fully distributed, and handling projects as large as the Linux kernel.[9]
Pro Git says the main difference from most other systems is that they store a list of file-based changes, while Git thinks of its data as a series of snapshots.[5] Files move through three states, modified, staged and committed, which match three areas: the working tree, the staging area and the Git directory; committing stores the staged snapshot permanently.[10] Each commit object points to its snapshot and records the author’s name and email, the message and its parent commit or commits.[11]
Pro Git says everything in Git is checksummed with a SHA-1 hash, a 40-character hexadecimal string, before it is stored, so the contents of a file or directory cannot change without Git noticing.[6] Hash functions of this kind are explained in how encryption works.[12]
Branches and merging
Branching means diverging from the main line of development to work without disturbing it.[7] In Git a branch is simply a lightweight movable pointer to a commit, which makes creating and switching branches nearly instantaneous.[7]
When two branches have diverged, Git performs a three-way merge using the two branch tips and their common ancestor, and records the result as a new merge commit.[13] If the same part of the same file was changed differently on both branches, Git cannot merge them cleanly: it pauses and leaves the merge conflict for a person to resolve.[13]
Read next
How open-source software works (licences and foundations)
What makes software open source, popular licences like MIT and copyleft ones like the GPL, who runs Linux and Apache, and shared-code security risks.
Questions readers ask
What is version control used for?
It records changes to files over time so you can go back to specific versions later. Git's official book uses source code as its example but notes that it works with nearly any type of file.[1]
What is the difference between centralized and distributed version control?
Centralized systems such as CVS, Subversion and Perforce keep all versioned files on one server, which is a single point of failure. In distributed systems such as Git and Mercurial, every client mirrors the full repository and history, so each clone is a full backup.[2][3]
What is a commit?
In Git, a commit stores the staged snapshot permanently in the repository. The commit object points to that snapshot and records the author's name and email, the message and the parent commit or commits.[10][11]
What is a branch?
Branching means diverging from the main line of development to work without disturbing it. In Git a branch is just a lightweight movable pointer to a commit, so creating and switching branches is nearly instantaneous.[7]
What is a merge conflict?
When the same part of the same file has been changed differently on two branches, Git cannot merge them cleanly. It pauses the merge and leaves the conflict for a person to resolve before committing.[13]
Who created Git?
The Linux kernel community, and in particular Linus Torvalds, built Git in 2005 after the free-of-charge status of BitKeeper, the proprietary tool the kernel project had used since 2002, was revoked.[4]
Sources
· 13 claims from 2 publishers
Each numbered claim is a statement we checked against the sources listed with it. Tap a number in the text to see its sources in place.
- [1]
Pro Git, Git's official book, defines version control as a system that records changes to a file or set of files over time so that specific versions can be recalled later, and notes it works for nearly any type of file, not only source code. confirmedas of 2026-11-14
- Pro Git, 1.1 Getting Started: About Version Control · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.1 About Version Control (retrieved 2026-11-14)
- Pro Git, 1.1 Getting Started: About Version Control · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.1 About Version Control (retrieved 2026-11-14)
- [2]
Centralized version control systems such as CVS, Subversion and Perforce keep all versioned files on a single server that clients check files out from, which makes that server a single point of failure. confirmedas of 2026-11-14
- Pro Git, 1.1 Getting Started: About Version Control · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.1, Centralized Version Control Systems (retrieved 2026-11-14)
- Pro Git, 1.1 Getting Started: About Version Control · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.1, Centralized Version Control Systems (retrieved 2026-11-14)
- [3]
In a distributed version control system such as Git or Mercurial, each client mirrors the whole repository including its full history, so every clone is a full backup that can restore a failed server. confirmedas of 2026-11-14
- Pro Git, 1.1 Getting Started: About Version Control · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.1, Distributed Version Control Systems (retrieved 2026-11-14)
- Pro Git, 1.1 Getting Started: About Version Control · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.1, Distributed Version Control Systems (retrieved 2026-11-14)
- [4]
Git was created in 2005 by the Linux kernel community, led by Linus Torvalds, after the free-of-charge status of BitKeeper, the proprietary tool the kernel project had used since 2002, was revoked. confirmedas of 2026-11-14
- Pro Git, 1.2 Getting Started: A Short History of Git · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.2 A Short History of Git (retrieved 2026-11-14)
- Pro Git, 1.2 Getting Started: A Short History of Git · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.2 A Short History of Git (retrieved 2026-11-14)
- [5]
Pro Git says the major difference between Git and most other version control systems is that the others store information as a list of file-based changes, while Git thinks of its data as snapshots. confirmedas of 2026-11-14
- Pro Git, 1.3 Getting Started: What is Git? · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.3, Snapshots, Not Differences (retrieved 2026-11-14)
- Pro Git, 1.3 Getting Started: What is Git? · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.3, Snapshots, Not Differences (retrieved 2026-11-14)
- [6]
Git checksums everything with a SHA-1 hash, a 40-character hexadecimal string, before storing it, so the contents of a file or directory cannot change without Git knowing. confirmedas of 2026-11-14
- Pro Git, 1.3 Getting Started: What is Git? · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.3, Git Has Integrity (retrieved 2026-11-14)
- Pro Git, 1.3 Getting Started: What is Git? · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.3, Git Has Integrity (retrieved 2026-11-14)
- [7]
Branching means diverging from the main line of development to work without disturbing it; in Git a branch is simply a lightweight movable pointer to a commit, which makes creating and switching branches nearly instantaneous. confirmedas of 2026-11-14
- Pro Git, 3.1 Git Branching: Branches in a Nutshell · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 3 Git Branching (retrieved 2026-11-14)
- Pro Git, 3.1 Git Branching: Branches in a Nutshell · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 3.1 Branches in a Nutshell (retrieved 2026-11-14)
- Pro Git, 3.1 Git Branching: Branches in a Nutshell · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 3 Git Branching (retrieved 2026-11-14)
- [8]
Most Git operations need only local files and resources, with no information needed from another computer on the network. confirmedas of 2026-11-14
- Pro Git, 1.3 Getting Started: What is Git? · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.3, Nearly Every Operation Is Local (retrieved 2026-11-14)
- [9]
Pro Git lists Git's original design goals as speed, simple design, strong support for non-linear development with thousands of parallel branches, being fully distributed, and handling large projects like the Linux kernel efficiently. confirmedas of 2026-11-14
- Pro Git, 1.2 Getting Started: A Short History of Git · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.2 A Short History of Git (retrieved 2026-11-14)
- [10]
Files in Git can be modified, staged or committed, matching three areas of a project, the working tree, the staging area and the Git directory; a commit stores the staged snapshot permanently in the Git directory. confirmedas of 2026-11-14
- Pro Git, 1.3 Getting Started: What is Git? · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.3, The Three States (retrieved 2026-11-14)
- Pro Git, 1.3 Getting Started: What is Git? · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.3, The Three States (retrieved 2026-11-14)
- Pro Git, 1.3 Getting Started: What is Git? · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 1.3, The Three States (retrieved 2026-11-14)
- [11]
A Git commit object points to the snapshot of staged content and records the author's name and email, the commit message and pointers to its parent commit or commits. confirmedas of 2026-11-14
- Pro Git, 3.1 Git Branching: Branches in a Nutshell · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 3.1 Branches in a Nutshell (retrieved 2026-11-14)
- [12]
NIST's Secure Hash Standard specifies hash algorithms that produce message digests, which are used to detect whether a message has been changed since the digest was generated. confirmedas of 2015-08-04
- FIPS 180-4: Secure Hash Standard (SHS) · NIST Computer Security Resource Center · Primary source · 2015-08-04 · Abstract (retrieved 2026-11-07)
- [13]
When branches have diverged, Git performs a three-way merge using the two branch tips and their common ancestor and creates a merge commit; if the same part of a file was changed differently on both branches, Git reports a merge conflict and pauses for a person to resolve it. confirmedas of 2026-11-14
- Pro Git, 3.2 Git Branching: Basic Branching and Merging · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 3.2, Basic Merging (retrieved 2026-11-14)
- Pro Git, 3.2 Git Branching: Basic Branching and Merging · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 3.2, Basic Merging (retrieved 2026-11-14)
- Pro Git, 3.2 Git Branching: Basic Branching and Merging · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 3.2, Basic Merge Conflicts (retrieved 2026-11-14)
- Pro Git, 3.2 Git Branching: Basic Branching and Merging · git-scm.com (Pro Git, Scott Chacon and Ben Straub) · Primary source · 3.2, Basic Merge Conflicts (retrieved 2026-11-14)
Revision history (1)
- Page created.
Created Nov 14, 2026. Last reviewed by an editor on Nov 14, 2026. Next scheduled review: Aug 14, 2027.
Cite this page
"How version control works: commits, branches and Git." ContentLora, updated Nov 14, 2026. https://contentlora.com/explain/how-version-control-works
Spotted an error? Suggest a correction or emailcorrections@contentlora.com.