Blobs

Blobs: How Git Stores File Content

A blob holds the bytes of one file version and nothing else: no name, no permissions, no timestamp. Git 1,932 hashes a header (blob, a space, the size and a NUL byte) followed by the content, and stores both zlib-compressed. You can reproduce the key with sha1sum and read the object back with Python:

Recomputing a blob's hash and decompressing the objectShell
printf 'blob 9\0BookNest\n' | sha1sum
python3 -c "import zlib,sys; print(zlib.decompress(open(sys.argv[1],'rb').read()))" \
  .git/objects/25/c8a459b6e162ac7b759d609872fcdbfce206f6
echo 'BookNest' > README.md
git hash-object README.md
Output
25c8a459b6e162ac7b759d609872fcdbfce206f6  -
b'blob 9\x00BookNest\n'
25c8a459b6e162ac7b759d609872fcdbfce206f6

A README.md with the same bytes is the same blob, so identical files are stored once. It also means your blob and tree hashes in this section match the book's exactly; only commit hashes differ, because commits record your name and the time.