Git snapshots vs diffs: why one commit holds the whole project

By Christophe Paka · Facts checked on 7 November 2026

Git is version control: software that records every saved version of your files, so you can go back. You run git log and see its saves, called commits. Most people picture each one as a patch, a short list of changed lines stacked on the one before. That picture is wrong.

It costs you later. If a commit is a patch, opening an old version or undoing a change feels like a risky guess. This post settles git snapshots vs diffs with one drawing of three files over three versions.

You will see why Git opens any old version in one step, and why your repository does not balloon as you commit.

Three files A, B and C over three versions. Left, other systems store V1 in full, then only changes in V2 and V3, so V3 means replaying the chain. Right, Git commits C1 to C3 each hold every file; unchanged files point to the stored copy.
Figure 1.1 Other systems replay a chain of changes; Git reads one snapshot, whose unchanged files point to copies it already has.
Use this diagram on your site

Free to share in your blog post, docs, course or slides, as long as the credit link stays. Paste the code below where the figure should go.

How to read this figure

  1. Start on the left at V1. The left side shows older version control systems ("Other VCS" in the figure). They store the first version in full. Files A, B and C sit there as whole files, with dark borders. Everything after V1 is built on top of them.

  2. Follow the chain through V2 and V3. The Greek letter Δ (delta) means "a change". A box such as ΔB1 holds only the lines of file B that changed since the last version; that list of changed lines is called a diff. A dash means the file did not change. To read V3, the system starts at V1 and replays every change in order.

  3. Jump to the right at C1. Git stores commits, and commit C1 holds a full snapshot: A, B and C as they were at that moment. A snapshot is a record of every file in the project, not of what changed.

  4. Read C2: one file changed. Only B changed, so C2 holds B', the edited version. A and C are grey: Git does not copy them again, it reuses the copies it already stored. Git calls each stored file copy a blob. The dashed arrows show two of these reuses: A from C1, and B' from C2 into C3. See what a commit points to for more on blobs.

  5. Read C3: still a full snapshot. A and C changed, so C3 holds A' and C', and points to the stored B'. To read C3, Git reads C3 alone. No chain to replay, which is why any old version opens in one step.

Key takeaways

  • Read each commit as the whole project at one moment, not as a patch on the last one.
  • Run git diff when you want the changes: Git computes them from two snapshots when you ask.
  • Commit small and often: unchanged files are stored once, so the repository grows only by the files you changed.

Worked example: count the stored files in the figure

Take the right side of the figure and count how many file copies Git keeps after each commit.

  1. C1 stores A, B and C: 3 copies.
  2. C2 changes only B. Git stores B' and reuses A and C: 4 copies in all.
  3. C3 changes A and C. Git stores A' and C' and reuses B': 6 copies in all.
  4. Each commit still lists all three files, so each one is a full snapshot.
  5. On the left, reading V3 means V1 plus every change after it. On the right, reading C3 means three lookups.

Result: Three full snapshots cost 6 file copies, not the 9 that three full copies of three files would take, and reading any one of them takes one step. Snapshots are not wasteful, because Git reuses what did not change.

Questions readers ask

Does a Git commit store the whole file or just the changes?

A commit stores a snapshot: a record of every file as it was at one moment. Files you did not change point to the copy Git already has. Git computes the changes only when you ask, with git diff.

If every commit is a snapshot, why is my repository not huge?

Git does not copy an unchanged file again. It points to the copy it already stored, so the repository grows only by the files that changed in each commit.

What is a commit ID?

It is a hash: a short fingerprint computed from the commit's content. It is 40 characters in full and usually shown short, such as c66d5f8. Each commit also records the ID of the one before it, so editing an old commit changes every later ID.

Sources: Pro Git 1.3: What is Git? (git-scm.com); About Git (git-scm.com).

This figure is from Git Made Crystal Clear, chapter 1.

The chapter builds the idea step by step, with recipes you can follow, a Try it to check yourself, and every source.

Get the book

All diagrams