Lesson 1 · Unit 02
Refs and HEAD
A branch is forty characters in a file
What you practise
- A branch is a file holding a commit hash, HEAD points at a branch, committing moves the branch,
git switch -c, detached HEAD without fear
Try a question from this lesson
Pick one
A repository has 10,000 commits. You create a new branch. Roughly how much does git write to disk?
Correct answer
One file of about 41 bytes
Why
A branch is a file under .git/refs/heads holding one commit hash: 40 characters and a newline. That is why branching is instant whatever the size of the project, and why you should branch freely.
The idea
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Two kinds of pointer
A branch is a file holding one commit hash. main is the file .git/refs/heads/main.
HEAD holds the name of the branch you are on. When you commit, git writes the new commit and moves that branch to it. No other branch moves.
one <--- two <--- three
^
main <--- HEAD11 more exercises in the app
- 4× multiple choice
- 3× type the answer
- 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.