Git Fundamentals — What Version Control Actually Is
Git Is a Snapshot Machine, Not a Diff Tool
Forget "Tracking Changes"
Most people assume git stores a list of line-by-line diffs, like a fancy version of Word's "track changes." It doesn't. Every commit is a full snapshot of your entire project at that moment. Git is just very good at compressing and deduplicating those snapshots so it doesn't waste space.
This distinction matters because it explains why git operations that sound scary — jumping between branches, rewinding history, comparing two commits from months apart — are actually cheap and safe. You're not replaying a chain of patches. You're just pointing at a different snapshot.
The Three Trees
Every git repo has three areas your files can live in:
| Area | What it is |
|---|---|
| Working Directory | The files on disk you're actually editing |
| Staging Area (Index) | The draft of your next commit — git add puts things here |
Repository (.git) |
The permanent, committed history — git commit puts things here |
git init # create a new repo
git add file.ts # working dir → staging
git commit -m '' # staging → repo (a new snapshot)
git status # what's staged vs. unstaged vs. untracked
If someone tells you they "don't really get branches, so they just keep folders called backend-old and backend-new-2," this lesson is the entire fix. Snapshots, not diffs — everything else follows from that.
What does a git commit actually store?