Beginner7 min

Reviewing Changes and Undoing Mistakes

An agent will sometimes do the wrong thing confidently. That is fine and expected. What separates a calm builder from a frustrated one is having a clean way to review what changed and a reliable undo button. That undo button is version control, and you do not need to be an expert to use it.

Step 1: Put your project under Git

Git takes snapshots of your project so you can always return to a known-good state. Let the agent set it up for you, then commit once everything works.

zsh - todo-app
# start tracking the project
$git init
Initialized empty Git repository
# save a snapshot once it works
$git add -A && git commit -m "working to-do list"
1 file changed, 84 insertions(+)
$

Step 2: Read every diff before you trust it

Before committing, look at what the agent changed. Green lines were added, red lines were removed. You are checking for surprises: deleted code you wanted, a renamed file, a stray dependency.

git diff index.html
  <button class="add">Add</button>
- <button class="del">x</button>
+ <button class="del danger">Delete</button>

Step 3: Undo cleanly when it goes wrong

If the agent breaks something and you have not committed yet, you can throw away the changes and return to your last snapshot. This is your safety net, so commit often.

zsh - todo-app
# discard all uncommitted changes
$git restore .
Reverted to last commit. Crisis averted.
$
Commit before big asks
Before you tell the agent to do something large or risky, make a commit first. A clean snapshot means you can experiment freely and roll back in one command if it goes sideways.

Hands-on tasks