Skip to content

Git Object Model

Spicy — senior dev territoryGit & Version Control

ELI5 - The Vibe Check

Under the hood, git doesn't actually store files and folders the way your operating system does. It stores everything as one of a few object types: a blob (raw file content), a tree (a directory listing pointing to blobs and other trees), and a commit (a snapshot pointer plus metadata). Every git command you run, from checkout to merge to log, is really just walking this small graph of objects glued together with hashes.

Real Talk

Git's object model consists of object types stored in the .git/objects database, each addressed by the hash of its content: blobs (file contents), trees (directory structure mapping names to blob or tree hashes), commits (a tree hash, parent commit hash, author, and message), and tags (a named pointer to another object). Because objects are content addressed and immutable, identical file content across the entire history is stored exactly once, which is also why git detects renames by content similarity rather than tracking a rename operation explicitly.

When You'll Hear This

"Git doesn't track renames, it just notices the blob hash matches." / "Every commit is basically a pointer to a tree, which points to more blobs."

Made with passive-aggressive love by manoga.digital. Powered by Claude.