Git Foundations
Posted on August 28, 2020 in Git by Matt Jennings
The information below is from Git Foundations chapter of Git In-depth.
How does git Store Information?
- git is like a key value store.
- The Value = date
- The Key – Hash of the Date
- You can use the key to retrieve the content.
The Key – SHA1
This value should always be the same if the given input is the same.
The Value – Blob
git store the compressed data in a blog, along with metadata in a header.
Where Does git Store Its Data?
In the .git directory.
The blobs are stored in the .git/objects directory.
Tree
A tree contains pointers (using SHA1) to:
- blobs
- other trees
- metadata
Other Optimizations – Packfiles, Deltas
The PackFile stores the object, and “deltas”, or the differences between one version of the file and the next.
Commit
Definition: A code snapshot.
References – Pointers to Commits
- Tags
- Branches
- HEAD – a pointer to the current commit (there can only be one HEAD at a given point in time)