Course B · Module B1 Production · Lesson 1 of 18
Never fear breaking your app again — you'll have save points, full undo history, and a way to work on two things at once.
At the end of Course A you shipped something real — and then probably held your breath every time the AI rewrote a file. That fear is rational: one wrong change and the app stops working, and you have no clean copy to go back to. That ends here. Your single win in this lesson: by the end you'll understand Git and GitHub well enough to always have a safe way back, and to experiment freely knowing nothing is ever permanently broken.
Think of a video game with unlimited manual saves. Every time you reach a good checkpoint, you hit Save. If the next dungeon kills you, you reload — you never lose the whole run. Git is that for your code.
Each save is called a commit. A commit is a labeled snapshot: "working homepage," "added contact form," "payment flow done." Your full project history is a stack of these snapshots going back to day one. You can jump back to any of them in seconds.
Imagine you want to redesign your homepage — but you're not sure it'll work, and you don't want to wreck the version your customers see right now. A branch solves this exactly.
A branch is a parallel copy of your project. You make one, experiment freely on it,
and when you're happy you merge it back into the main copy. If the experiment
fails, you delete the branch and your main copy is completely untouched. The AI can
suggest "create a branch called new-homepage" and do it for you — you
just need to know why it matters.
Git lives on your computer. GitHub is where your project lives on the internet — a permanent, backed-up, shareable copy. Think of it as Dropbox for code, except it understands every commit and branch in your history.
When your AI coding tool (Cursor, Replit, v0, Lovable, etc.) says "push to GitHub," it is uploading your latest commits to that cloud home. Benefits you get automatically:
Here's a problem you'll hit as your app grows: you're in the middle of building a new feature, but a bug just broke something for customers and you need to fix it right now — without losing all your half-finished feature work.
The standard answer is to stash your work, switch branches, fix the bug, switch back, and unstash. That's fiddly. A worktree is a better answer: it lets Git check out a second branch into a second folder on your computer, so both branches exist as live folders simultaneously. You fix the bug in one folder, ship it, then walk back to the other folder and carry on with the feature — no juggling, no switching, no lost work.
Your AI tool can set this up for you. Tell it: "Create a worktree for the
hotfix branch so I can work on it without losing my feature/signup
work." It will run the one-line command. You just need to understand what the
two folders represent.
feature/signup branch, half-built, safe where it is.hotfix branch, checked out fresh, ready to edit.Answer before opening — recalling it is what makes it stick.
Roll back to the last good commit. Because you committed before the rewrite, Git has a labeled snapshot of exactly what was working. You tell the AI "revert to commit X" or check out that commit — the broken version disappears and the good one is restored instantly.
Git is the save-points system that runs on your computer; GitHub is the cloud service where those save points are stored, backed up, and shared. You can use Git entirely offline — but without pushing to GitHub, a lost laptop means lost history.
Check out the fix as a worktree in a separate folder. Your half-finished dashboard work stays exactly where it is in its folder. You fix the payment bug in the second folder, commit, push, and deploy. Then you walk back to the dashboard folder — nothing changed, nothing lost.
Read this next (primary source)
About GitHub and Git — GitHub Docs. The official plain-English introduction: what Git is, what GitHub adds, and how the two fit together. ~8 min. See RESOURCES.md for more.
New terms from this lesson — commit, branch, repository, deploy — are in the course glossary. Keep it open as you go.