Skip to the workspace
Pebellslearn by building
Version Control and Testing  ›  Lesson

Commit Before You Prompt

Master Version Control 12 minCommit a working, tested state before every AI change, and use a branch for risky experiments, so any bad change can be thrown away cleanly.

vibe coding / Commit Before You Prompt

Explore each scene at your own pace.

01 · The rule

The rule

Commit Before You Prompt

Kitty works. You ask a coding agent for one more feature, and it edits seven files. Now nothing loads, and you cannot remember what those files looked like an hour ago. Neither can the assistant. With an assistant that can change many files in seconds, you need an undo button that covers the whole project. Version control is that button.

The rule

Commit a working state before each AI change, so every mistake is undoable.

Git, the most widely used version control system, records commits: snapshots of your project that you can compare with and return to. The everyday rhythm around an assistant is short:

git status                  # anything unsaved? start from a clean state
git add -A                  # stage every change
git commit -m "Record expenses and list them"
# ...now ask the assistant for the next change...
git diff                    # what did it change in tracked files?
git restore .               # throw those changes away, if you need to

A few details matter:

  • git restore . discards unstaged edits to files git already tracks. Brand-new files the assistant created are not touched; git status lists them so you can delete them.
  • For a riskier experiment, use a branch, a separate line of work: git switch -c uneven-splits. If it goes well you merge it into your main branch; if not, you switch back and delete it.
  • Write commit messages for future you: say what changed and why, like "Store amounts in paise to stop rounding errors", not "stuff".
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.