Git Notes

Git is Content-Addressible Storage

Git is a CAS, a kind of database, with a VCS on top of it. The CAS commands are plumbing commands that deal with this underlying database. The usual git {add,rm,commit} commands are compound porcelain commands that build on top of these lower level commands.

This means that you can actually use the plumbing commands to manually add, remove, commit things. The “Git Internals” section of the handbook has great examples.

But I used git cat-file to really investigate a lot of things. git cat-file -p will determine the type of object before pretty catting it.

There are four Types of Objects: blob, tree, tag, and commit.


There are three areas: Working, Staging, and Repository.

Working -> Staging

Staging -> Respository

When you git rm you are ‘adding’ the deletion from the Working to the Staging area. This is a small head-scratcher until you see the tree object and note that the file(s) you just deleted are no longer referenced. That’s ultimately what happens. The file blob is not deleted; it’s part of git forever (until you use some tool to parse history and remove it manually.)

Other Trivia

Everything git writes is just a blob. There’s no binary/text types.

The reflog does not contain all commits.