There are three kinds of git objects: blob, tree, and commit.
- Blob
- analogous to a file
- store file data
- only store content of a file, not its name or permission (which is in tree)
- Tree
- analogous to a folder
- store directory structures
- Commit
- store commit data
All Git objects are identified by a SHA-1 hash, also known as the “object hash”. Git calculate object hash before compression. This is because there may be multiple output of the compression algorithm with the same input depending on settings
Git objects are stored in in the .git/objects
directory with with path derived from its hash.
We can inspect the content of a git object by git cat-file
Related
- git cat-file: inspect the content of an git object file
- git hash-object: compute the git object hash of a file