If an AI agent changed or deleted a file unexpectedly, stop it from making further changes, identify exactly what was affected, and inspect the available history before restoring anything. Use the agent’s checkpoint or rewind only if it covers the change; for tracked files, Git may provide another recovery point. If neither contains the file, check your operating system, sync provider, or backup system. No single rollback method necessarily reverses shell commands or actions outside your workspace.
1. Stop the activity and assess what changed
- Stop further risky work. If the agent is still running or an unwanted operation is underway, use the session’s stop or cancel control. Avoid starting another task that could overwrite the affected files.
- Establish the scope. Identify the earliest unwanted change and list the affected paths. Check the editor’s change list or checkpoint view, then review source-control status and diffs, recent agent tool calls, terminal output, and error messages.
- Separate file edits from other effects. Determine whether the impact is limited to workspace files or also includes a shell command, network request, deployment, or change to an external service. The recovery method depends on that distinction.
VS Code’s agent recovery guide recommends establishing the scope before choosing a recovery action. Preserve useful evidence—such as the diff or command output—while you investigate, and don’t restore broadly until you know which work you need to keep.
As an Amazon Associate I earn from qualifying purchases.
2. Check whether the agent session has a suitable recovery point
Agent rollback features are product- and session-specific. A checkpoint or rewind can help only if a suitable recovery point exists and covers the unwanted change.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →| Recovery option | What it may restore | Limits to account for |
|---|---|---|
| VS Code checkpoint | Affected workspace files and chat history, when a checkpoint from before the change is available. | Checkpoints are temporary. They do not reverse completed terminal commands, network requests, deployments, or changes to external services. |
| GitHub Copilot CLI rewind | The conversation, or the conversation plus files tracked by that CLI session, depending on the option chosen. | File restoration requires file-change tracking and a rewind point. The CLI can skip files that no longer match its last written content or are too large to back up. |
| Git restore | A specified tracked path, restored from the index by default or from a chosen tree such as a commit. | It replaces the working-tree contents with the selected source. It cannot recover content that never entered a recoverable Git state. |
Restore a VS Code checkpoint
In a supported VS Code agent session, inspect the available checkpoints and select one from before the unwanted file changes. Review what the checkpoint will affect before confirming. A checkpoint restore can also rewind chat history; it is not an undo for terminal or outside actions. Microsoft states: “Checkpoints don’t reverse terminal commands, network requests, deployments, or changes to external services.” See Get an agent back on track for the current session controls and details.
#1 Best Overall
- Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
Rewind a GitHub Copilot CLI session
GitHub documents /undo or /rewind, and pressing Esc twice while idle, to open the CLI’s rewind picker. Choose conversation-only rewind if you want to change the conversation without restoring files, or choose the option that also restores files if the session has a suitable rewind point and file tracking was enabled. File restoration is relative to the state before the selected prompt began; inspect the result because some files may be skipped. Follow the current Copilot CLI rollback instructions for the exact behavior in your version.
Do not assume another IDE or agent has either of these controls, or the same rollback boundaries. Check that product’s documentation and the controls available in the affected session.
Rank #2
- Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
3. Restore a tracked file with Git
First inspect the working tree. GitHub’s Copilot CLI recovery guidance recommends git status to see modified, staged, and untracked paths, and git diff to review unstaged changes. If a file is staged, inspect the staged diff too with git diff --staged.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →git status
git diff
git diff --staged
For a specific tracked path, git restore uses the index as its source by default. For example, to restore a deleted tracked file from the index:
Rank #3
- Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
git restore -- path/to/file
To restore that path from a known-good commit instead, specify the source:
git restore --source=<commit> -- path/to/file
Replace the example path and commit with the ones you have verified. A path-specific restore limits the target, but overwrites that path’s current working-tree contents with the chosen source. If the path is absent from the selected source, Git removes it to match that source. The Git restore manual also documents --patch for selecting changes interactively. Review the diff and source before restoring, especially if the file contains unrelated edits you want to keep.
Rank #4
- Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
4. Look beyond agent history and Git when needed
If the missing content is not present in an agent recovery point or a Git source you can use, check the recovery options actually configured for your system. Depending on your setup, these may include:
Recommended Free Tools
- Your operating system’s deleted-items or file-recovery feature.
- Your cloud or network sync provider’s file history or deleted-file recovery.
- A backup system that captured the file before the change.
- The affected external service’s own recovery controls, if the agent changed something outside the workspace.
These options vary by system and configuration; they are not guaranteed to exist or to contain the needed version. In particular, Git restore only draws from the index or a chosen tree, so it is not a substitute for a backup of content that never entered Git’s recoverable history.
Best Value
- [Upgraded Version] - This external hard drive features a mirrored logo stripe combined with a striped anti-slip design, and the rounded corners of the casing make it easier to grip. The stripes also have a heat dissipation function, ensuring stable and fast data transfer.
- 【Ultra-thin and quiet】 - The motherboard adopts JMicron 578 noise-free solution, giving you a quiet working environment. Lightweight and portable size designed to fit in your pocket for easy portability.
- 【Ultra-Fast Data Transfers】 - Pairing this external hard drive with JMicron 578 solution USB 3.0 and USB 2.0 interfaces enables blazing-fast data transfer. It boasts theoretical read speeds of up to 125MB/s and write speeds of up to 103MB/s.
- 【Plug and Play】 - With no software to install, just plug it in and the drive is ready to use.The hard disk chip is wrapped with an aluminum anti-interference layer to increase heat dissipation and protect data.
- 【What You Get】 - 1 x Portable Hard Drive, 1 x USB 3.0 Cable, 1 x User Manual, Gift-type shell packaging ,Three-year manufacturer's warranty and free technical support services.
5. Verify the result, then reduce the risk next time
Verify recovery
After a restore or rewind, check git status and inspect the relevant diff again. Open the recovered files and confirm that the content is the version you intended. Separately check any commands or external actions identified during triage: a file rewind does not show that those actions were reversed.
Set safer boundaries for future agent work
- Before a large or risky task, create a known-good Git commit so there is a clear starting point.
- Define the files or areas the agent may change and state acceptance criteria; for larger tasks, ask it to propose a plan first.
- Review the first meaningful changes early rather than waiting until the whole task is complete.
- Keep manual approval for unfamiliar workflows, particularly when tools can run commands or affect external services.
- Use permission controls and sandbox boundaries suited to the tools involved. VS Code’s trust and safety documentation distinguishes terminal sandboxing from file access: its terminal sandbox applies to terminal commands and child processes, while built-in file tools use VS Code’s permission system. Platform support and maturity vary, and sandboxing is not a universal undo mechanism.
A Git worktree, an agent checkpoint, a terminal sandbox, a remote repository, and a general backup solve different problems. Treat each according to what it actually records or restricts, rather than assuming any one of them protects every file or outside action.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minute




