VCF

Unit 8 · Vibe coding with guardrails

git revert undoes one commit, not the latest

git revert <commit> undoes the one commit you name by adding a new commit that reverses it. It is not “undo the last thing”. Read the log, find the AI change, and revert that one, not your save point.

The mix-up

What people often think

“Revert undoes whatever happened most recently.”

What the tutor says

Revert undoes one specific commit, the one you pick. Read the commit messages and choose the AI change, not your save point.

How it works

Git tracks what changed, not whether it was a good idea. Only you, the diff and your tests can tell a good change from a bad one.

Working on a branch makes all of this calmer: a mistake there never reaches the version people use.

An example

What worksExample
git log --oneline
#  a1b2c3d  AI: rewrite search filter
#  9f8e7d6  Before AI edit
git revert a1b2c3d
Revert the change you do not want.

Close cousins of this mix-up

The tutor watches for these in the same lesson.

  • “Git can tell good changes from bad ones.”

    Git tracks what changed, not whether it was a good idea. Only you, the diff and your tests can tell.

  • “Working straight on main is fine for small changes.”

    Small AI changes are the ones that slip through. On a branch, a mistake never reaches the version people use.

Practise it with a tutor watching

Git as an undo button

Commit, branch, read the diff and revert, so a bad AI change costs you a minute instead of a day.

20 minutes See it Build it Break it Say it
Start the lesson

Free, no account needed.