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 toA few details matter:
git restore .discards unstaged edits to files git already tracks. Brand-new files the assistant created are not touched;git statuslists 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".
The shortcut
Before every prompt, run green, commit, prompt: the tests pass (green), you commit, and only then do you ask for the change. Never prompt on top of uncommitted work you would hate to lose.
Green
Kitty's tests all pass, and the app works when you try it by hand.
The trap is the long unsaved stretch: an hour of prompts, some good and some bad, and no commit in between. Then the only choices are keeping everything or losing everything.
Drills
Answer fast — trust the rule.
Why commit before asking an assistant for a change?
What does git diff, with nothing after it, show after the assistant edits files?
The assistant's change tangled five files and you committed just before prompting. What is the best move?
Which commit message is the most useful?
Where should a risky experiment like uneven splits happen?
Remember
- Rule: commit a working state before each AI change, so every mistake is undoable.
- Shortcut: green, commit, prompt. Use a branch for anything risky.
- Trap: a long stretch of prompts with no commit, leaving you all-or-nothing.
