Level 1: The Magic Hash

Git: Time-Traveler's FS

Unlock the secrets of the .git folder. Scroll down to play.

SHA-1

Content Addressability

Git doesn't care about filenames. It cares about Content. It uses a SHA-1 hash (40 characters) as the unique ID for every piece of data.

da39a3ee5e6b4b0d3255bfef95601890afd80709
CHALLENGE: Type "git" into the box. Memorize the first 2 chars (e.g., '46'). Delete it, then type "git" again.
BLOB

The Object Database

Git stores data as Blobs. It takes the hash, uses the first 2 chars as a folder name, and the rest as the filename.

Empty Database
CHALLENGE: Add a file with content "Hello". Then change the filename but keep content "Hello" and Add again.
TREE

The Tree (Directory)

If Blobs don't have names, how does Git know `a1b2` is `main.cpp`? It creates a Tree object. Think of it as a directory listing.

Target Blob: ...
tree <size>\0
100644 blob ... ...
Tree SHA-1: Waiting...
CHALLENGE: Rename `main.cpp` to `test.cpp` and create the tree. The Tree Hash will change, but the Blob hash inside stays the same!
COMMIT

The History Chain

A Commit is a wrapper. It holds a pointer to a Tree, an Author, and a Parent Commit.

MERGE

Boss Battle: 3-Way Merge

Git merges by comparing Base (ancestor), Yours, and Theirs.

Both sides changed "Blue". You changed it to Red. They changed it to Green. What happens?

<<<<<<< HEAD Color: Red ======= Color: Green >>>>>>> feature