Git's objects
Now that you know Git stores every commit as a full tree state or snapshot, let's look closer at the object's Git store in the repository.
Git's object storage is a key-value storage, the key being the ID of the object and the value being the object itself. The key is an SHA-1 hash of the object, with some additional information such as size. There are four types of objects in Git, branches (which are not objects, but are important), and the special HEAD
pointer that refers to the branch/commit currently checked out. The four object types are as follows:
Files, or blobs as they are also called in the Git context
Directories, or trees in the Git context
Commits
Tags
We will start by looking at the most recent commit object in the repository we just cloned, keeping in mind that the special HEAD
pointer points to the branch currently checked out.
Getting ready
To view the objects in the Git database, we first need a repository to be examined. For this recipe, we will clone an example...