The official Git reference, free and translated. From first commits to the guts of .git.
Why this book
Pro Git was written by Scott Chacon, one of the founders of GitHub, and Ben Straub, a long-time Git contributor. It's the official book recommended on git-scm.com. Unlike most programming books that become obsolete or expensive, this one stays free, gets updated regularly (the version I read dates from April 2024), and is available in over 40 languages including French.
What makes it worth reading beyond the official docs: it doesn't just explain what commands do. It explains why Git works the way it does. The branching model, the three-tree reset, the internals chapter — they're all about building a mental model that makes the confusing parts obvious. Once you understand why branches are just 41-byte pointer files, nothing about branching surprises you anymore.
The ideas that stay
1Snapshots, not diffs — the paradigm shift
Git doesn't store what changed. It stores a picture of everything, every time. "With Git, every time you commit, Git basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot" (p. 14). Other systems (CVS, Subversion) store files plus a series of deltas — to reconstruct version 37, they replay changes from version 1. Git stores version 37 directly. This is why Git doesn't need the server to browse history, why it's fast, and why every clone is a complete backup.
2Everything is checksummed — nothing is lost silently
"Everything in Git is checksummed before it is stored and is then referred to by that checksum" (p. 15). That checksum is a SHA-1 hash: a 40-character hexadecimal string like 24b9da6552252987aa493b52f8696cd6d3b00373. You can't change a file's contents without Git knowing. And Git nearly always adds data — nearly nothing is permanently deleted until you explicitly garbage-collect. The book's phrasing is precise: "It is hard to get the system to do anything that is not undoable." Except git reset --hard.
3The three states and the staging area
Files in Git live in one of three states: modified (changed but not yet staged), staged (marked for the next commit), or committed (safely stored). The staging area is the key: it's a file inside .git/ that stores exactly what will go into the next snapshot. This is what lets you commit only part of your working changes, or build a clean commit from messy work. Most beginners skip it and use git commit -a for years before understanding what they've been bypassing.
git add README.md # stages one file git add -p # stages parts of files interactively git commit -m "message" # commits exactly what was staged
4A branch is a pointer to a commit — nothing more
The book's most clarifying sentence: "A branch in Git is simply a lightweight movable pointer to one of these commits" (p. 64). Creating a branch doesn't copy code, doesn't create a directory, doesn't do much of anything. It writes a 41-byte file (a SHA-1 hash plus a newline) in .git/refs/heads/. That's it. Every time you commit, the pointer moves forward automatically. This explains why branching in Git is instantaneous where it was expensive in Subversion.
# A branch is literally just this file: $ cat .git/refs/heads/main ca82a6dff817ec66f44342007202690a93763949 git branch feature # creates a 41-byte file git checkout feature # moves HEAD to point to it
5HEAD is a pointer to a pointer
HEAD is a special file that points to the current branch, which points to the current commit. When you checkout a branch, Git updates HEAD to point to that branch. When you commit, the branch pointer moves, and HEAD follows. This is how Git knows where you are in the history. When you git checkout a specific commit SHA instead of a branch name, you enter "detached HEAD" mode — HEAD points directly to a commit, not to a branch, and any new commits you make won't be attached to any branch.
6The perils of rebasing — and its one rule
Rebase replays your commits on top of another branch, producing a cleaner linear history than merge. The book states its rule bluntly: "Do not rebase commits that exist outside your repository and that people may have based work on. If you follow that guideline, you'll be fine. If you don't, people will hate you, and you'll be scorned by friends and family." The reason: rebasing rewrites SHA-1 hashes. If someone has already based work on those old hashes, force-pushing rebased commits creates contradictory histories that are painful to reconcile.
7Reset demystified: the three trees
The book frames git reset through "three trees" Git manages: HEAD (the snapshot of the last commit), the Index (the proposed next commit = the staging area), and the Working Directory (your actual files). Reset operates on them in sequence, stopping when you tell it to.
"This flag (--hard) is the only way to make the reset command dangerous, and one of the very few cases where Git will actually destroy data" (p. 262). Use it knowingly, not reflexively.
8Git is a content-addressable filesystem
Chapter 10 opens with: "Git is fundamentally a content-addressable filesystem with a VCS user interface written on top of it" (p. 414). Everything stored in Git — file contents, trees, commits — is an object addressed by its SHA-1 hash. The .git/ folder contains four things that matter: objects/ (the database), refs/ (named pointers to commits), HEAD (current branch), and index (the staging area). That's all of Git.
Three things I didn't know before reading it
- Git was created in 10 days. After BitKeeper revoked free access in 2005, Linus Torvalds spent about two weeks building Git. The first commit of Git is in Git's own history. The Linux kernel project migrated to it immediately.
- The
masterbranch is not special. "The 'master' branch in Git is not a special branch. It is exactly like any other branch. The only reason nearly every repository has one is that git init creates it by default" (p. 64). You can delete it, rename it tomain, or never use it — Git doesn't care. - "Porcelain" vs "plumbing" is the book's vocabulary for the two layers of Git: the user-facing commands you run every day (checkout, commit, branch) are porcelain; the low-level commands that manipulate objects directly (hash-object, cat-file, update-ref) are plumbing. All the porcelain commands are built on the plumbing.
My take, honestly
The first three chapters are the best introduction to Git that exists. The snapshot model, the three states, and the branching-as-pointers explanation are worth reading even if you've been using Git for years. Most developers develop an intuition for Git without ever understanding why it works — these chapters supply the why in under 100 pages.
Chapters 4 through 6 are more uneven. The server setup chapter is useful if you're self-hosting, irrelevant if you're on GitHub. The GitHub chapter was accurate when written, but GitHub has changed enough that some screenshots and workflows are outdated. I'd skip straight to chapter 7 after chapter 3 for most use cases.
The book was written with the command line as the primary interface. In 2026, many developers interact with Git through VS Code's built-in source control or through GitHub Desktop. That's fine — but this book will teach you things those GUIs silently hide from you. Understanding reset's three trees, for instance, makes you a much better user of any Git UI.
Odilon
Still relevant in 2026?
The version I read dates from April 2024. Git itself hasn't changed fundamentally since the second edition: SHA-1 objects, refs, staging area, the branching model — all identical. The main update is that the book now uses git restore and git switch (introduced in Git 2.23) alongside the older git checkout and git reset forms. The GitHub chapter dates faster than the rest. The internals chapter is timeless.
Who is it for?
Read it if
- You use Git daily but sometimes find yourself guessing what a command will do
- You've broken something with reset or rebase and want to understand why
- You want to understand what's actually in
.git/— the objects, the refs - You're free to read for free: there's no reason not to
Skip it if
- You need a quick-start tutorial: the official git-scm.com docs or Atlassian's tutorials are faster for that
- You're looking for team workflows and branching strategies (Gitflow, trunk-based): the book covers them lightly
- You're a Git expert already: you likely know everything in chapters 1-3
For going further
The concepts in this book are practiced directly in the Git & Terminal course on this site. For team collaboration and branching workflows, the official GitHub documentation is more current than chapter 6. For diving deeper into Git internals, the source code itself is surprisingly readable.
Comments (0)