datacamp-logo

How does Git store information?

You may wonder what information is stored by each commit that you make. Git uses a three-level structure for this.

  1. A commit contains metadata such as the author, the commit message, and the time the commit happened. In the diagram below, the most recent commit is at the bottom (feed0098), underneath its parent commits.
  2. Each commit also has a tree, which tracks the names and locations in the repository when that commit happened. In the oldest (top) commit, there were two files tracked by the repository.
  3. For each of the files listed in the tree, there is a blob. This contains a compressed snapshot of the contents of the file when the commit happened (blob is short for binary large object, which is a SQL database term for "may contain data of any kind"). In the middle commit, report.md and draft.md were changed, so the blobs are shown next to that commit. data/northern.csv didn't change in that commit, so the tree links to the blob from the previous commit. Reusing blobs between commits help make common operations fast and minimizes storage space.

Commit-Tree-Blob Structure


Looking at the diagram, which files changed in the most recent commit to this repository?

Answer the question
50 XP
Possible Answers
  • press
  • press
  • press