What is the Git object model?

Definition

The Git object model represents files and history as immutable objects. Blobs store file content, trees describe directory entries and commits point to a root tree and parent commits.

Each object is identified by a hash derived from its content. This provides integrity and deduplication, but reconstructing a checkout can require many related objects and storage lookups.

ELI5

The Git object model stores a repository as linked, content-addressed objects. Blobs hold file data, trees describe folders, commits point to snapshots and parents, and annotated tags name important objects.

For example, checking out one commit means following its tree links until Git finds the required blobs. Each object's identifier comes from its contents, which helps detect changes and reuse identical data.

Acronyms and aliases

Git data model variant

Frequently asked questions

Which objects are part of the Git object model?

Git uses blob, tree, commit and annotated tag objects, each identified by a content-derived object ID.

Why does Git use content-addressed objects?

Content addressing detects changes, supports integrity checks and allows identical content to be stored and transferred efficiently.

Videos explaining Git object model