Step 01 / 11
What is a branch?
Concept
Keyword: branch A branch is a name that points to a commit. It's like a sticky note placed on a page of a book. The sticky note says: "I am here". When you add a new commit, the sticky note moves to the new page.
Many people think a branch is a copy of the code. That's not true.
A branch is just a pointer. It's a small file that contains the hash of a commit. Creating a branch is instantaneous. It takes almost no disk space.
$ # Each branch points to a commit main → a1b2c3d (most recent commit on main) feature → e4f5g6h (most recent commit on feature) HEAD → main # HEAD says: "you are on the main branch"
Concept
Key point The main branch is not special. It's just a name. Git creates it by default, but you could call it anything. It has no special power.
“Creating a branch copies the whole project's code.” True or false?