What is a Git commit object?

Definition

A Git commit object does not contain every file directly. It points to a tree that represents the repository root and to zero or more parent commits that connect it to history.

The commit's content determines its object ID, so changes to the tree, parents or metadata produce a different commit. Loading a commit snapshot may require traversing many tree and blob objects.

ELI5

A Git commit object records one repository snapshot by pointing to a root tree, earlier parent commits and metadata such as the author and message. It connects a project state to its history.

For example, changing a file produces a new tree and then a new commit that points to it and the previous commit. Any change to that content or metadata produces a different commit identifier.

Acronyms and aliases

commit object variant

Frequently asked questions

What does a Git commit point to?

It points to a root tree and parent commits and includes author, committer, timestamps and the commit message.

Why can reconstructing a commit require many lookups?

The commit references a tree hierarchy whose entries point to more trees and blobs needed to assemble the full repository snapshot.

Videos explaining Git commit object