What Are Git Objects?

Git objects are stored in a compressed and serialized format in the Git database. When users make some changes to a repository, Git creates new objects to represent those changes and adds them to the database. In Git, users can efficiently store and manage large amounts of data, making it an ideal tool for version control and collaboration in software development by storing objects in a compressed format.

This blog will briefly state about Git objects.

What are Git Objects?

Objects play a significant role in Git. These are the basic unit of data which is used to represent information in a Git repository. Git objects are the building block of a repository and are being utilized for denoting everything from individual files to entire branches.

There are four types of Git objects which are listed below:

Let’s discuss them one by one!


A blob object represents the content of a file in a particular repository. It is a simple binary representation of the file’s contents. BLOB stands for “Binary Large Object”. In Git, a BLOB is used to represent each version of a file. A BLOB stores a file’s data but has no name or other recognizable details about the file.

When a user makes changes to a file in a Git repository and commits those changes, Git makes the latest blob object to show the updated contents of the file. Each blob object is identified by a unique SHA-1 hash, which is dependent on the contents of the blob. It enables Git to store and retrieve blob objects efficiently and ensures that the contents of the blob remain unchanged over time.


A tree object represents a directory in a repository that contains references to other blobs or tree objects that represent the files and directories in the directory. It represents a directory in a repository and contains references to other Git objects such as blob objects (which represent the contents of individual files) or other tree objects (which represent subdirectories within the directory).

When a user commits changes to a Git repository, Git creates a new tree object to represent the state of the directory at that point in time. The tree object includes metadata, such as file types and the name of the file, as well as a list of pointers to all of the directories and files in the directory.


The repository is captured in a snapshot by a commit object at a specific time. It includes a reference to a tree object that represents the state of the repository, as well as metadata, such as the author and commit message.


An identified reference to a particular commit in the repository is represented by a tag object. Releases and other significant milestones in a project’s development history are frequently marked with tags.

We have briefly explained the Git objects.


Git objects play a significant role in Git working. There are four Git objects, including “Blob”, “Tree”, “Commit”, and “Tag”. Where the blob object represents the content of a file in a stated repository. Next, the tree object contains references to other blobs or tree objects. The commits object represents a snapshot of the repository and committed changes. The tag object represents a named reference to a specific commit in the repository. This guide demonstrated the Git objects in detail.

About the author

Hafsa Javed