Foundations

How Git Thinks

~20 min

Snapshots, Not Differences

Most version control systems store changes as a list of differences (what changed from version to version). Git does something different.

Other Systems: Differences

Version 1: Create file.txt Δ Add line 5 Δ Change line 2 Δ Delete line 7

To see version 4, must replay all changes from the beginning.

Git: Snapshots

📸 Snapshot 1 📸 Snapshot 2 📸 Snapshot 3 📸 Snapshot 4

Each snapshot is a complete picture, instantly accessible.

â„šī¸Why does this matter?

Snapshots are faster to access and more reliable. Git does not need to rebuild a version by replaying changes.

âš ī¸Wait, does that waste space?

Good question. If every commit stored a complete copy of everything, your repository would grow huge. Git is clever about this - let us see how in the next section.