seniorGit

How does Git store data internally (objects, trees, commits, blobs) and why does it matter?

Updated Apr 23, 2026

Short answer

Git stores content as immutable objects (blobs, trees, commits, tags) addressed by SHA-1/256, enabling efficient history, deduplication, and integrity.

Deep explanation

Git is a content-addressable filesystem. Blobs store file contents, trees store directory structure (filenames → blob/tree hashes), commits point to a tree plus metadata (author, message, parents), and tags annotate commits. Because objects are immutable and identified by hashes, identical content is stored once, ensuring integrity and enabling cheap branching/merging. Packs compress objects for efficiency. Understanding this explains why rebases rewrite history (new commit objects) and why corruption is detectable.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Git interview questions

View all →