<!-- How to undo what an AI agent did in Notion, GitHub and files · https://www.mcpdelta.com/guides/undo-ai-agent-changes · updated 2026-10-13 -->

> An AI agent changed or deleted something? See what changed, undo it in Notion, GitHub or your files, and what can never be taken back.

[Delta MCP](https://www.mcpdelta.com/) [Guides](https://www.mcpdelta.com/guides)

Guide

# How to undo what an AI agent did in Notion, GitHub and files

Updated 13 October 20267 min read By the Delta MCP team

The short answer

Undo it in the tool where it happened, because each tool keeps its own history. In Notion, restore the page from Trash or Version history. In GitHub, revert the commit or restore the branch. For files, use Git, your AI app’s checkpoints or a backup. A message already sent is the hard one.

## How do you see what your AI changed?

Look before you undo, so you know exactly what to put back. Each tool keeps its own record of what changed.

-   `Version history` in Notion. On the page, click **•••** at the top, then **Version history**. Pick a version to see the highlights of what changed. Notion saves a version every 10 minutes while someone edits, and again two minutes after the last edit.
-   `git diff` in a project under Git. It shows the edits you have not staged yet. `git diff HEAD` compares your files with the latest commit.
-   `git reflog` records each time a branch tip was updated in your local repository. If your AI may have moved or reset a branch, look here for where it stood before. Entries last 90 days by default, or 30 days for commits the branch no longer reaches.

If your AI worked through Delta MCP, Activity already shows each change before and after. More on that below.

## How do you undo it, tool by tool?

Each tool keeps its own history, so you undo in the tool where the change happened. Find your case.

How to undo an AI’s change in Notion, GitHub and your files, with each tool’s limits and official page
| What happened | What to do | Limits | Official page |
| --- | --- | --- | --- |
| Notion: a page was edited | Open the page, click **•••**, choose **Version history**, open an earlier version and click **Restore**. To keep today’s page, copy only the blocks you need. | You need Can edit access. It goes back 7 days on Free, 30 on Plus, 90 on Business and any number on Enterprise. It shows the main highlights, not every change. A database restore brings back its pages and properties, not the text inside them. | [Notion: Delete & restore content](https://www.notion.com/help/duplicate-delete-and-restore-content) |
| Notion: a page or database was deleted | Open **Trash** in the sidebar, open the page and restore it. | Pages stay in Trash for 30 days by default. Notion’s own MCP server deletes by moving pages to Trash, up to 20 per call. | [Notion: Delete & restore content](https://www.notion.com/help/duplicate-delete-and-restore-content) [Notion: Supported tools (Notion MCP documentation)](https://developers.notion.com/guides/mcp/mcp-supported-tools) |
| GitHub: a pull request was merged | Open it and click **Revert**. GitHub creates a new pull request that reverts the merge commit. Merge that one. | You need write permission. With merge conflicts, revert the commits with `git revert` instead. | [GitHub: Reverting a pull request](https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/reverting-a-pull-request) |
| GitHub: commits were pushed, or a file was deleted | `git revert HEAD` records a new commit that undoes the latest one. Name another commit to undo that one instead. GitHub’s MCP file tools take a commit message, so their changes are commits too. | It needs a clean working tree. To revert a merge commit, add `-m 1` to name the parent that stays as the mainline. Git then treats the merged changes as never wanted. A later merge brings in only commits that were not part of it. | [Git: git-revert Documentation](https://git-scm.com/docs/git-revert) [GitHub: GitHub MCP Server (README on GitHub)](https://github.com/github/github-mcp-server) |
| GitHub: a branch was deleted | Open the closed pull request that used the branch and click **Restore branch**. | It works for the head branch of a closed pull request. | [GitHub: Deleting and restoring branches in a pull request](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/deleting-and-restoring-branches-in-a-pull-request) |
| GitHub: a repository was deleted | Open **Deleted repositories** in the Settings of your account or organization, then click **Restore**. | Within 90 days, and not if it was part of a fork network that is not empty. It can take up to an hour after the deletion before you can restore it. Team permissions are not restored. | [GitHub: Restoring a deleted repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/restoring-a-deleted-repository) |
| Files edited by Claude Code or Cursor | Claude Code: run `/rewind` or press Esc twice on an empty prompt, pick a prompt and choose **Restore code**. Cursor: click a checkpoint in the chat timeline and restore it. | Claude Code keeps snapshots for the last 100 checkpoints, and drops them about 30 days after the session’s last save. It does not track `rm`, `mv` or `cp` run through Bash. Cursor’s checkpoints revert files only. Both point to Git for permanent history. | [Claude Code: Checkpointing (documentation)](https://code.claude.com/docs/en/checkpointing) [Cursor: Overview (Agent documentation)](https://cursor.com/docs/agent/overview) |
| Files in a Git project | `git restore notes.md` gets a deleted or changed file back from Git’s index. Add `--source=HEAD` to take it from your latest commit instead, or name another commit, branch or tag. | It restores from the index or a commit, so Git can only give back what you committed or staged. Restoring overwrites the file as it is now, so run `git diff` first to see what you would lose. | [Git: git-restore Documentation](https://git-scm.com/docs/git-restore) [Git: git-diff Documentation](https://git-scm.com/docs/git-diff) |
| Files, with a backup | On a Mac, open a window for the item, then open Time Machine from Spotlight. Step back through your backups with the arrows, select the item and click **Restore**. | You need a Time Machine backup made before the change. | [Apple: Restore items backed up with Time Machine on Mac](https://support.apple.com/guide/mac-help/restore-files-mh11422/mac) |

## What can’t be undone?

Some changes leave the tool where your AI made them, or outlast the time a tool gives you. No restore button reaches those.

-   A message already sent
    
    Gmail’s Undo Send is a button you get right after you send from its browser or app. You choose 5, 10, 20 or 30 seconds in Settings. Once that time is over, the message is out.
    
-   A file removed by a shell command
    
    Claude Code’s checkpoints do not track `rm`, `mv` or `cp` run through Bash. Look in Git or in your backup.
    
-   Anything past a time limit
    
    Notion keeps pages in Trash for 30 days by default. Notion’s support says it can also restore a snapshot of your content from the past 30 days. GitHub restores a deleted repository within 90 days.
    
-   What the change set off elsewhere
    
    A restore fixes the page or the code. It does not recall an email, a notification or anything else the change already triggered.
    

## What does Delta MCP add?

Delta MCP is a free app on your computer. It sits between your AI and your tools, such as Notion, GitHub, Linear, Vercel or your files. It records what your AI changes through it, task by task, with each change before and after.

Each task is one sentence in Activity, such as “Set status to Archive on 4 pages in Notion”. Delta MCP writes it from the changes themselves. Undo starts there.

1.  **Pick the task in Activity**
    
    Search by sentence, connector, name or object. Open it to see each change, before and after. A change that Delta MCP read back and found in place is marked **Checked**.
    
2.  **Click Undo and read the sheet**
    
    The sheet says what Undo will do before it does anything.
    
3.  **Click Undo again**
    
    Delta MCP puts the changes back. Anything someone changed since is left as it is.
    

The sheet has up to three parts

-   Comes back: what Undo puts back, including deleted items that return as new copies
-   Changed since, left as is: what someone changed after your AI, which Undo does not touch
-   Doesn’t come back: what can’t be undone, such as a message already sent

So you know, before you click, what comes back and what doesn’t. Some actions can’t be undone, such as a message already sent. Delta MCP tells you which, before you click and again after.

It can also stop the change first. In the modes that ask, a card opens before anything is made. It shows each change before and after, and what can be undone.

[Activity and Undo, in the docs](https://www.mcpdelta.com/docs/activity-and-undo)

## How do you stop it happening again?

Give your AI less rope, and keep a copy it cannot reach. Each setting is small, and each lives in a different place.

-   Start read only GitHub’s MCP server has a `--read-only` flag that offers only read tools. Open up writing when the task needs it.
-   Ask before deleting Notion marks its delete tools as destructive (`destructiveHint`). An MCP client can use that hint to ask before running one. Check whether your app does.
-   Commit before a long session Checkpoints in Claude Code and Cursor are for undoing your AI’s edits. Both point to Git for permanent history. Commit first, then let your AI work.
-   Keep a backup A backup made before the change brings back a file that was never in Git.
-   Pick a mode in Delta MCP Four modes, for each connector: change on its own, ask before deleting or sending, ask before every change, read only. You can set single actions apart. Delta MCP decides what counts as deleting or sending from the action’s name.

[Modes, in the docs](https://www.mcpdelta.com/docs/modes)

Setting access in each tool has its own guide. [How to give an AI access to your tools safely](https://www.mcpdelta.com/guides/safe-ai-access-mcp)

### Try Delta MCP on your own tasks

Free, two minutes to set up, and you can put everything back in one click.

[Download for Mac](https://www.mcpdelta.com/download)

Free · No account · Put everything back in one click

## Questions

### Can you undo what an AI agent did?

Yes, in the tool where it happened, if that tool kept a history and its time limit has not passed. Notion has Version history and Trash, GitHub has revert and restore, and Git or a backup covers files. A message already sent is the exception.

### How do I undo a Notion page my AI deleted?

Open Trash in the sidebar, open the page and restore it. Pages stay in Trash for 30 days by default. Notion’s own MCP server deletes by moving pages to Trash, so the same restore applies.

### How do I undo my AI’s changes in GitHub?

For a merged pull request, click Revert on it: GitHub opens a new pull request that reverts the merge. For commits, use `git revert`. For a deleted branch, open its closed pull request and click Restore branch. A revert needs write permission.

### My AI deleted my files. Can I get them back?

Check Git first: `git restore notes.md` gets a deleted file back from Git’s index. Add `--source=HEAD` to take it from your latest commit. In Claude Code, `/rewind` restores edits made with its file tools, not files removed by `rm` in Bash. Otherwise use a backup such as Time Machine.

### Can you unsend an email your AI sent?

In Gmail, only in the seconds after you send from its browser or app. Undo Send lets you cancel for 5, 10, 20 or 30 seconds, as you set in Settings. Treat a message your AI sent as sent.

### Does Delta MCP undo what my AI did?

Yes, for tasks that went through it. Pick the task in Activity, click Undo and read the sheet, which says what will be put back. Some actions can’t be undone, such as a message already sent. Delta MCP tells you which, before you click and again after.

## Sources

1.  [**Notion**, Delete & restore content](https://www.notion.com/help/duplicate-delete-and-restore-content) Version history (access, limits by plan, highlights, database restore), Trash and its 30 days, and Notion’s backups.
2.  [**Notion**, Supported tools (Notion MCP documentation)](https://developers.notion.com/guides/mcp/mcp-supported-tools) Notion’s MCP delete tools move pages to Trash, are marked destructive, and a restore tool brings pages back.
3.  [**GitHub**, Reverting a pull request](https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/reverting-a-pull-request) The Revert button, the write permission and the merge-conflict case.
4.  [**GitHub**, Deleting and restoring branches in a pull request](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/deleting-and-restoring-branches-in-a-pull-request) Restoring the head branch of a closed pull request.
5.  [**GitHub**, Restoring a deleted repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/restoring-a-deleted-repository) The 90-day window, fork networks, team permissions and who can restore.
6.  [**GitHub**, GitHub MCP Server (README on GitHub)](https://github.com/github/github-mcp-server) The tools that write, with a commit message, and the read-only flag.
7.  [**Git**, git-revert Documentation](https://git-scm.com/docs/git-revert) git revert records new commits that undo earlier ones; reverting a merge with -m.
8.  [**Git**, git-restore Documentation](https://git-scm.com/docs/git-restore) Restoring files from a commit, branch or tag with --source.
9.  [**Git**, git-reflog Documentation](https://git-scm.com/docs/git-reflog) The reflog records branch tip updates; the 90-day and 30-day defaults.
10.  [**Git**, git-diff Documentation](https://git-scm.com/docs/git-diff) git diff and git diff HEAD.
11.  [**Claude Code**, Checkpointing (documentation)](https://code.claude.com/docs/en/checkpointing) /rewind, the 100 checkpoints and about 30 days, and Bash changes that are not tracked.
12.  [**Cursor**, Overview (Agent documentation)](https://cursor.com/docs/agent/overview) Checkpoints before significant changes; restoring reverts files only; stored apart from Git.
13.  [**Google**, Send or unsend Gmail messages (Gmail Help)](https://support.google.com/mail/answer/2819488) Undo Send and its 5, 10, 20 or 30 second window.
14.  [**Apple**, Restore items backed up with Time Machine on Mac](https://support.apple.com/guide/mac-help/restore-files-mh11422/mac) The steps to restore an item from a Time Machine backup.
15.  [**Delta MCP**, Activity and Undo](https://www.mcpdelta.com/docs/activity-and-undo) Activity, the Undo sheet, and the warning about what can’t be undone.
16.  [**Delta MCP**, Modes](https://www.mcpdelta.com/docs/modes) The four modes and the card that shows each change before and after.

## Keep reading

-   [How to give an AI access to your tools safely (MCP) MCP permissions in plain words: four access levels, where to set them in Claude, Cursor, VS Code, GitHub and Notion, and how to start read-only.](https://www.mcpdelta.com/guides/safe-ai-access-mcp)
-   [MCP tool call timed out? Check the write before retrying MCP tool call timed out? The change may still have happened. Check before you retry, see which calls are safe to repeat, and set the timeout.](https://www.mcpdelta.com/guides/mcp-write-timeout)

![](https://www.mcpdelta.com/brand/app-icon.svg)

## Try Delta MCP on your own tasks

Free, two minutes to set up, and you can put everything back in one click.

[Download for Mac](https://www.mcpdelta.com/download) Also for [Windows](https://www.mcpdelta.com/download#windows) [Linux](https://www.mcpdelta.com/download#linux)

Free · No account · Apple chip or Intel
