The key part of a Git repo is a key-value data store where each object has its own hash value. Git objects can be found under
.git/objects directory. Two noticeably subdirectories when initializing an empty Git repo are: info and pack. Also, there are few types of objects including: blobs, trees, commits and tags.
An empty Git repo will list the following folders under
The info subdir usually stores a packs file containing list of all .pack files (which I’ll get back to them in a second) and a commit-graph which basically is a binary file that creates a graph out of the Git’s commit history. Regarding new projects, this folder will be empty.
The pack subdir stores .pack files. These pack files are the end result after running the Git garbage collector. I wrote more in details about git gc, so you might want to check that out.
Basically, pack files are compressed loose objects where loose objects being all non-packed objects (files). That’s how Git wants to kick off. Starts creating files as loose objects and then after running
git gc pack everything you can.
For new projects, this folder should be empty too. Otherwise, it contains .idx and .pack files where the latter one being the actual pack file and the former one the index. Both are binary files. Most objects are.
Now, about object types:
blobs: binary objects that keep each file’s content.
trees: objects storing directory listing. The three important trees including: the Commit history, the Staging area and the Working directory. Related: Git: HEAD vs working tree vs index.
commits: objects saving commit’s metadata: author, data, commit message, and the committer (the one who created the commit).
tags: objects holding human-readable names referring other Git objects, mostly commits. Related: Git 101: tags.