Quiz
Warm-up from lesson 1-2. In Git's history, how are commits connected?
A branch is just a movable label
Here's the demystifying fact of the whole course: a branch is a tiny file containing one commit hash. That's all. A 41-byte sticky note saying "this line of work is currently at commit c7d8e9f."
You've had a branch all along: main, created automatically by git init in lesson 2-1. Every time you commit, Git creates the new snapshot and then moves the current branch's label forward onto it. The label follows the work.
And HEAD from lesson 3-1? Normally HEAD points at a branch, and the branch points at a commit. "You are on main" literally means HEAD → main → c7d8e9f.
Why this matters: because branches are just labels, creating one is instant and free. Engineers spin up a branch for every experiment, feature, and bug fix, because trying ideas costs nothing and main stays untouched until the idea proves itself.
See the file with your own eyes
This isn't a metaphor to take on faith — the file is really there. Inside .git, every branch is one plain text file at .git/refs/heads/<branch-name>, and its entire contents are one commit hash. cat it and you've read a branch.
Our sandbox has no Git installed, but the layout is just folders and files, so you can recreate it exactly and prove to yourself how little a branch is.
Code exercise · bash
Your turn. Recreate Git's branch storage by hand. The folder repo/.git/refs/heads and the main branch file already exist. Create a second branch the way Git would: write the hash a9f8e7d6c5b4a3f2e1d0c9b8a7f6e5d4c3b2a1f0 into a file named new-sauce next to main (echo with >), then list the branch files and cat your new one.
Quiz
Physically, what is a Git branch?
Problem
git init created one branch for you automatically back in lesson 2-1. What is its default name in modern Git?