If you build with AI, git is the single best safety net you can have. It's also the thing most vibe coders skip because it looks scary. This guide covers git for vibe coders: five commands, what each one does in plain English, and the one habit that makes AI mistakes painless.
What git is, in one sentence
Git takes snapshots of your whole project, called commits, so you can always go back to any snapshot you made.
Think of it as a save point in a video game. The AI can try something bold, and if it goes wrong, you reload.
Command 1: start tracking (once per project)
git init
Run this once, in your project folder. It tells git to start watching. If your project came from a template or GitHub, it may already be set up; running git status will tell you.
Command 2: see what changed
git status
Shows which files changed since your last save point. Run it any time you're unsure what the AI touched. It changes nothing, so it's always safe.
Command 3: make a save point
git add -A
git commit -m "working login page"
The first line says "include every change". The second makes the snapshot with a short label. Make one whenever something works, and always before asking the AI for a big change. The label should describe what works right now, so future you can find it.
Command 4: throw away unsaved changes
git restore .
The AI made a mess since your last save point? This puts every tracked file back to how it was at that save point. Be careful: changes made after your last commit are gone for good, which is exactly why Command 3 matters. Brand new files the AI created aren't removed by this; git status will still list them.
Command 5: see your history
git log --oneline
Lists your save points, newest first, one per line. Useful when something broke a while ago and you want to see where you were. To actually undo an old commit safely, git revert plus the commit's code creates a new commit that reverses it, without deleting history. Our guide to undoing AI changes walks through that and how to rescue "lost" commits.
Commands to never let the AI run without asking
These can permanently destroy work:
git reset --hardgit cleangit push --forcerm -rf
Put a rule in your Cursor rules or CLAUDE.md saying the AI must explain what will be lost and wait for your "yes" before running any of them. See Cursor rules for beginners or what to put in CLAUDE.md.
Back it up online
Git on your laptop protects you from the AI, not from a lost laptop. Push your project to a private repository on GitHub (or similar) so there's a copy somewhere else. Your AI can walk you through connecting it; just make sure the repository is set to private, and that your .env.local file is listed in .gitignore so your secrets don't go with it.
The one habit
Before every big AI request, make a save point. That's it. Do that, and any AI mistake becomes a ten-second git restore . instead of a lost evening.
Get the cheat sheet
The Ship-Safe Starter Kit includes a plain-English git undo cheat sheet ("I broke it, how do I go back?") where every command was tested in a practice project. The free starter pack has a rule that makes your AI remind you to save before big changes.
Vibe Shipped is independent and not affiliated with GitHub. Written with AI assistance and reviewed by a human.
Want these rules ready-made?
The free starter pack has them, set up for Cursor and Claude Code.