Get your API key

Lesson 5 of 5

Review and undo AI changes

Read diffs in Source Control, discard or keep changes, restore from Timeline, and rewind agent checkpoints.

9 min Log in to open
One step at a time, like flipping pages.

By the end of this lesson you will review every change an AI agent made in VS Code's Source Control view, keep the good ones with a commit, and undo the bad ones the safe way.

You need: a project in Git (set it up) opened in VS Code, and a coding agent · Time: 9 minutes

  1. Open Source Control from the Activity Bar (the branch icon), or Ctrl + Shift + G (Mac Ctrl + Shift + G too). A number on the icon tells you how many files changed since your last commit (save point).

    VS Code's Source Control view with a badge of 12 on its icon, a commit message box and Commit button, lists of Staged Changes and Changes with M letters, and on the right a diff of a file with a removed line in red and the added lines in green
    Source Control: the list of changed files on the left, the diff of one file on the right.Source: Microsoft · code.visualstudio.com · Screenshot © Microsoft, used for education · used for education (image credits)

    The letters next to each file: M modified, U untracked (a new file), D deleted, A added to Git.

    Why?

    The agent's summary says what it thinks it did. The Source Control list shows what actually changed on disk, including files it forgot to mention.

Log in free to read the rest of this lesson

Every lesson is free. A free account unlocks all of them and saves your progress.

Still to come in this lesson:

  1. Read a diff
  2. Keep it: commit a save point
  3. Undo it: pick the safe way
  4. Why Git is still your real safety net
  5. Recap