Commit Object

suggest change

A commit is probably the object type most familiar to git users, as it’s what they are used to creating with the git commit commands.

However, the commit does not directly contain any changed files or data. Rather, it contains mostly metadata and pointers to other objects which contain the actual contents of the commit.

A commit contains a few things:

You can see the contents of any commit like this:

$ git cat-file commit 5bac93
tree 04d1daef...
parent b7850ef5...
author Geddy Lee <glee@rush.com>
committer Neil Peart <npeart@rush.com>

First commit!

Tree

A tree names every file in the project at that commit, and each blob is the whole file, not a diff. Each commit is a snapshot of the project.

Identical contents are stored once, because objects are named by hash. Conceptually, the commit still points at a complete tree.

Parent

The parent line contains a hash of another commit object, and can be thought of as a “parent pointer” that points to the “previous commit”. This implicitly forms a graph of commits known as the commit graph. Specifically, it’s a directed acyclic graph (or DAG).

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents