← All How-tos

How-to⁠ · ⁠ · GitHub Copilot CLI · 3 steps

Copilot CLI /rewind: Undo file changes in 3 steps

Copilot went one step too far?

Roll the session back to an earlier prompt and, if you like, put back the files Copilot changed.

You need: Any Copilot plan (every plan includes Copilot CLI), Copilot CLI installed, and at least one prompt in the current session. Plan source: GitHub Docs: plans for GitHub Copilot

Steps

  1. Wait until Copilot is idle and clear the input area. With text in the box, a double Esc just clears the text.
  2. Press Esc twice quickly, or type /undo or its alias /rewind, to open the rewind picker.
  3. Pick a rewind point, press Enter, then choose “Conversation only” or “Conversation + files”. Copilot shows a per-file preview before it restores anything.

Heads-up

  • Rewinding can’t be undone: the later session history is removed for good.
  • Copilot restores only the files it changed and skips any file you edited since. Changes to files over 10 MB, or from a turn that changed more than 500 files, aren’t captured.
  • Rewind isn’t available in remote-backed sessions or while work is still in progress.

An open GitHub issue says /rewind may find nothing to rewind in a session made with /fork, so it may not work there yet.

Source: GitHub Docs: roll back changes in Copilot CLI⁠ · GitHub Docs: plans for GitHub Copilot