Understand Git's object database vocabulary — blob, tree, commit, and tag objects, how pack files use delta compression to reduce size, and how git cat-file inspects the object store.
0 / 5 completed
1 / 5
What does a blob object store in Git's object database?
A blob stores file contents — nothing else. It has no filename or path; those are recorded in tree objects. Two files with identical content share one blob. Blobs are content-addressed: the SHA hash of the header + content is the object's identity, enabling deduplication.
2 / 5
What does a tree object in Git contain?
A tree object represents a directory. Each entry records a mode (e.g., 100644 for a regular file, 040000 for a directory), a filename, and the SHA pointing to either a blob (file) or another tree (subdirectory). The root tree of a commit captures the full snapshot of the working tree.
3 / 5
What information does a commit object contain in Git?
A commit object ties together a snapshot (root tree SHA), history (parent SHAs), and authorship (name, email, timestamp for both author and committer) plus the message. The parent SHAs form the DAG — merge commits have multiple parents. The tree SHA gives the complete directory state at that point in history.
4 / 5
What is a pack file in Git and why is it used?
Pack files (.git/objects/pack/*.pack + .idx) bundle thousands of Git objects into one file. Git applies delta compression — storing similar blobs (e.g., successive versions of a file) as a base object plus compact diffs — dramatically reducing repo size. Pack files are generated during git gc and git push.
5 / 5
What does git cat-file -t <SHA> output?
git cat-file -t SHA prints the type of the object: blob, tree, commit, or tag. Use -p (pretty-print) to see the contents in a readable form. These commands are the primary way to inspect Git's internal object database for debugging or learning purposes.