What is a Git tree object?

Definition

A Git tree object maps directory entries to other objects. File entries reference blobs, while directory entries reference additional trees, forming a hierarchy rooted at a commit.

Trees are immutable and content-addressed. A change to one file produces new objects along the affected path while unchanged subtrees can be reused.

Acronyms and aliases

tree object variant

Frequently asked questions

What information does a Git tree store?

It stores entry names, file modes, object types and object IDs for blobs, nested trees or submodule commits.

How is a Git tree different from a directory on disk?

A tree is an immutable repository object describing a snapshot, while a working directory is a mutable filesystem view.

Videos explaining Git tree object