4.3
Branches And GitHub Backup
What you need for this one
- Create a GitHub accountFree. You only need the account — the lesson does the rest.
Why this exists
Two gaps left before you're safe to build.
You can undo, but every experiment still happens on top of your real work — so trying something ambitious means contaminating the thing that currently works. And all of your history lives on one laptop, which is one coffee away from not existing.
Both close in this lesson, and then Level 5 can start.
The idea
A branch is tracing paper over the drawing. GitHub is the copy you keep somewhere else.
Branches. Make a branch and you get a parallel copy of the whole project. Everything you do happens there; your real work sits untouched. If the experiment works, you merge it in. If it doesn't, you delete the branch and it's as though it never happened.
The main line is usually called main. Think of it as the version that works.
| You want to | Do this |
|---|---|
| Try something you're not sure about | Branch |
| Make a change you're confident in | Straight onto main is fine |
| Try three approaches and compare | Three branches |
| Abandon an experiment | Delete the branch. Nothing to clean up. |
What branches actually change is your appetite. Right now, "let's see what happens if we restructure the whole thing" is a scary sentence, because it happens on top of the working version. On a branch it's free — worst case you delete it, and main never knew.
GitHub. A copy of your repository, with all its history, kept on a server. You push your commits up; they're safe there. New laptop, dead laptop, or working from somewhere else — you pull it back down and everything is exactly as it was, right down to the history.
It also does something quieter that matters more later: it's how more than one person works on the same thing without overwriting each other. That's not your problem this week, but it's why the whole industry uses it.
The two habits:
Branch when you're unsure. Push at the end of every working day.
The second is the one people skip, because nothing bad has happened yet. A week of uncommitted, unpushed work is a week that only exists in one place — and the point of this level is that you no longer keep anything valuable in only one place.
One boundary, and it's the same one as 4.1 but sharper: pushing publishes. Everything in the repository goes up, including anything you committed by accident. Set it private, and never let a key reach a commit in the first place.
Do
Use the real project from 4.2.
- Ask Claude to make a branch called
experiment. - Confirm you're on it — ask which branch you're on.
- Do something you'd never risk on your real work. Restructure the folders. Rewrite a file completely. Be genuinely reckless; that's the point.
- Look at the mess.
- Ask to switch back to
mainand deleteexperiment. - Check
mainin Finder. Untouched. Sit with that for a second. - Now a branch called
improvement. Make one real, genuine improvement. Commit it. - Merge it into
main. Confirm the improvement is there. - Set up GitHub. Create a private repository and push. Ask Claude to walk you through it.
- Open GitHub in your browser. Find your commit messages from 4.2. They're all there.
- Write in
branches.md: what you destroyed on the throwaway branch, and one thing you'd now be willing to try that you wouldn't have last week.
Step 11 is the real assessment. If nothing comes to mind, you were too cautious in step 3 — go back and break something properly. The whole value of a branch is what it makes you willing to attempt.
Done when
That's Level 4. You can undo anything, experiment without risk, and your work exists in more than one place. Now you can build something real.
Never do
Never make the repository public without checking what's in it. Pushing publishes — everything, including anything committed by accident, including the full history. Private by default, always.
Never end a working day without pushing. It takes ten seconds and it's the difference between a bad morning and a lost week.