By the end of this page, a branch will be the simplest thing in git: a tiny movable label, never a second copy of your project.
When most people hear the word "branch," they picture git duplicating their whole project: a second folder, a second set of files, twice the stuff on disk. That picture causes more confusion than anything else in git. So here is the sentence nobody says early enough:
A branch is not a copy of your project.
It is worth saying again, because your brain will try to sneak the wrong picture back in. A branch is not a copy of your project. It is a bookmark: a tiny label whose entire job is to say "the newest save point of this line of work is that one right there." That is all it stores. One little pointer.
Let's look at something real. These are two actual save points from your own project, the newest beads on your string. Right now, three different bookmarks are all clipped to the very same bead.
This is your project right now: three bookmarks, one bead. The green main bookmark marks the official line of work. The amber HEAD bookmark means "you are standing here." The violet origin/main bookmark remembers where main was on GitHub the last time your computer talked to it. When all three sit on the same bead, life is calm: you are on the official line, and as far as your computer knows, GitHub is fully up to date.
Here is the part that makes branches feel almost magical. You never push these bookmarks around by hand in daily work. They slide forward on their own.
Whenever you take a new photo of your project, a new bead appears on the string, and the bookmark you are standing on slips forward onto that new bead automatically. Think of the "you are here" pin on a mall map that follows you as you walk. You walk, it moves. You save, the bookmark moves.
So "being on main" simply means: every new save point you make becomes the new tip of main, and the green bookmark glides forward to sit on it. No dragging, no ceremony.
Because sometimes you want to try an idea without disturbing the official line. Maybe a redesign, a risky cleanup, a wild experiment. You clip a new bookmark, call it my-experiment, onto the same bead main is on. Nothing is copied. Nothing changes yet. You just gained a second tab.
Then you start saving. Your new beads grow under the experiment bookmark, which slides forward with each save, exactly like before. And main? Main does not budge. It stays clipped to the last official save, completely undisturbed.
Main never moved; your experiment grew beside it. If the idea works out, you can fold it back into the official line later, and we will do exactly that in a coming lesson. If it flops, you simply walk away. The official line never felt a thing.
This is the calmest fact on the page. When you delete a branch, you remove a bookmark, nothing more. No pages get torn out of the book. The save points themselves stay safe on the string, as long as some bookmark, or the chain leading back from one, can still reach them. Remember the promise from earlier lessons: committed work is almost impossible to lose.
You will create branches by hand in your practice playground soon. Here is a sneak peek at the spell, so it looks familiar when it arrives:
# inside a practice repo like /tmp/git-playground git switch -c my-experiment Switched to a new branch 'my-experiment' # older guides say: git checkout -b my-experiment (same thing, older word)
That command did two tiny things: it wrote one new bookmark on the current bead, and it moved HEAD onto it. Total cost: a blink.
Q. When you create a branch, git...
Q. A teammate deletes a branch. Is the work on it destroyed?