Theory
Theory: Content Addressing is the Whole Trick
Git is a content-addressed filesystem plus names. Internals are not trivia; they are why hosting, LFS, and fsck look the way they do.
Invariants
- Object name = hash of type + size + payload (SHA-1 historically, SHA-256 optional).
- Blobs have no filename; trees bind names to hashes.
- Packfiles are compression (deltas) of that object set, not the data model.
- A server is constrained by quarantine,
receive.denyCurrentBranch, and hook timing around these objects.
commit → tree → blob
\→ parent commit
packfile = many objects + delta chains (disk, not mental model)
What can break
- Editing files under
.git/objectsby hand. - Assuming SHA-1 collision is a daily concern (it is a research/hosting concern).
How to read this chapter
Object store, hashes, packfiles/git log, server-facing internals, cat-file lab.