Bitpath

Boss lesson · Unit 01

Inside .git

Blobs, trees and commits, named by their content

13 exercisesabout 3 min

What you practise

  • Blobs, trees and commits, content-addressed by hash
  • git hash-object and git cat-file -p to walk from a commit to a file
  • Why identical files are stored once and history can't change silently

Try a question from this lesson

Pick one

Two files hold exactly the same text. The last line counts the objects git has stored after git add. What does it print?

shell
git init -q
echo same > a.txt
echo same > b.txt
git add .
find .git/objects -type f | wc -l

The idea

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

Three kinds of object

Everything git stores is an object, named by the hash of its content.

A blob is the bytes of one file, with no name attached. A tree is a folder: a list of names, each pointing at a blob or at another tree. A commit points at one tree (the snapshot) and at its parent commits.

commit ---> tree ---> blob   (a.txt)
  |           \-----> blob   (b.txt)
  v
parent commit

11 more exercises in the app

  • 4× type the answer
  • 3× multiple choice
  • 1× fill the blanks
  • 1× true or false
  • 1× order the lines
  • 1× match the pairs

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy