In Bodega One Code there are three ways to undo what the agent did, from smallest to biggest. Undo in the Changes panel (Ctrl+Shift+D) reverses one hunk, one file or everything the agent changed. Checkpoints roll files back to how they were before a specific write. And Rewind, new in beta.54, restores the whole project folder to how it was before any prompt, including changes made by shell commands, formatters and sub-agents that never went through the editor. Restoring code saves a “Before restore” point first, so you can undo the undo. For git, the agent now uses dedicated git tools that scan staged changes before a commit and every outgoing commit before a push, always ask before a push, and never push to your main branch.
Every coding agent eventually does something you did not want: rewrites a file you liked, runs a formatter over the whole repo, or deletes the test it could not make pass. Your editor's Ctrl+Z does not help, because the agent did not type into your editor. It wrote to disk, ran commands and maybe committed. This post covers how to get back to where you were in Bodega One Code, and how the latest release keeps the agent from making a mess of your git history in the first place.
Why is undo harder with an AI agent?
Because most of what an agent changes never goes through an undo stack. An agent edits files directly, and it also runs things: npm install, a code formatter, a migration script, a sub-agent working in parallel. Those touch files the editor never opened. A git commit makes it worse, because now the change is in history too. So you need an undo that works at the level of the project folder, not the text buffer.
What are the three levels of undo?
| Level | What it reverses | Where |
|---|---|---|
| Undo | One hunk, one file, or every file the agent changed this session | Changes panel (Ctrl+Shift+D) |
| Checkpoint rollback | Files the agent wrote or edited, back to how they were before a specific write; files it created are removed | Changes panel → Checkpoints |
| Rewind | The whole project folder back to how it was before a prompt, including shell, formatter and sub-agent changes, and optionally the conversation too | Checkpoints → Rewind |
1. Undo a hunk, a file, or everything
When you allow a write, it lands on disk straight away; there is no separate Keep or Accept step to forget. The Changes panel lists every file the agent changed this session. Review opens a file's diff, where Undo hunk takes out one change and Undo file puts the whole file back. Undo all in the header reverses everything; a file you edited yourself after the agent is skipped and listed, never overwritten. A file you undid is marked Undone. If the agent had already committed, Undo all tells you which commit it was, so you can revert it in Source Control if you want it out of history too.
2. Roll back to a checkpoint
Every time the agent writes or edits a file with its file tools, Bodega saves that file's previous content as a checkpoint, and each chat keeps its newest 50. Shell changes and files over 2 MB are not in these; turn checkpoints, below, cover them. Open the Changes panel, choose Checkpoints, click a snapshot to preview it, then Rollback. Each file goes back to how it was before that write, any file the agent created is deleted, and a notice tells you how many files were restored and removed.
3. Rewind the whole project
This is the big one in beta.54. Before every prompt that starts a turn, Bodega saves a snapshot of the whole project folder (the very first turn in a project is skipped while it indexes, and a project that is too large is skipped). That means changes the agent made through shell commands, formatters and sub-agents can be undone too, one turn at a time. Turn checkpoints sit at the top of the Checkpoints panel. Click Rewind on one and choose:
- Restore code: every project file goes back to how it was before that prompt, and files created since are removed.
- Restore conversation: the chat goes back to that point, and your prompt is put back in the message box so you can edit and resend it.
- Restore code and conversation: both at once, for a clean retry.
Before a code restore, Bodega saves a Before restore checkpoint, so if you rewind too far you can restore that one and get back. It asks before every restore and refuses while the agent is running or waiting for you. A conversation rewind cannot be undone. The snapshots live in a private store in Bodega's own data folder, never in your project's .git, and they work in folders that are not git repositories at all, though git itself must be installed. Background runs, Fleet sessions, Loops and Issue runs also take a restore point before their first write.
A few things are left alone on purpose. Rewind restores files, not git: your commits, branches and staging area stay exactly as they are. It also skips files git ignores, files over 5 MB, node_modules and tool caches, nested repositories, and secret-named files such as .env and key files. File names are only a heuristic, so a secret inside an innocently named file can still be captured, in the private store on your computer. Unsaved edits in an open tab are kept and listed after a restore.
How do I undo the last thing the agent did?
- Open the Changes panel with
Ctrl+Shift+D, or click Review on the run summary. - If only one or two files are wrong, open each with Review and use Undo hunk or Undo file.
- If the whole turn went wrong, click Checkpoints, find the turn checkpoint at the top, click Rewind and choose Restore code.
- If you want to try the prompt again differently, choose Restore code and conversation instead, edit the prompt that comes back, and send it.
- If the agent had committed, revert or reset that commit in Source Control; Undo and Rewind leave git history alone.
How does Bodega One Code keep the agent out of trouble with git?
The best undo is the one you never need. Since beta.54, the agent has two dedicated git tools in place of raw shell git, and a plain git commit or git push typed into the shell is refused and routed to them, so the checks cannot be skipped that way. The one exception is git commit --amend, which still runs in the shell with your approval; the push scan still reads every commit before it leaves.
| What the agent does | Ask | Act | Plan |
|---|---|---|---|
| Read: status, diff, log, show, blame | Runs | Runs | Asks |
| Stage, branch, switch, commit | Asks, showing the files and message | Runs | Asks |
| Fetch | Asks | Runs | Asks |
| Pull or push | Always asks | Always asks | Always asks |
- Commits are checked for secrets. Staged changes are scanned for credentials before a commit, and every commit that would leave your machine is scanned before a push.
- Careful staging. The agent checks status first, stages named files instead of everything, and writes a
.gitignorebefore the first add. - No surprise pushes. A push card shows the exact destination, the branch and how many commits will leave. The agent never pushes to
main,masteror the default branch, and a run with nobody watching never pushes at all. - Your name on your commits. Agent commits are made as you and carry no attribution line unless you turn one on, and committing AI changes automatically is off by default.
- Hooks you approved. Approving a repository's git hooks now covers what those hooks run, such as the
package.jsonscripts a husky hook calls. A scheduled run stops before committing in a repository with hooks and keeps its worktree for you to check.
Can I keep the agent away from my working folder entirely?
Yes. In the composer's Location menu, turn on Work in a separate worktree (it needs a git repository with at least one commit, and it is off by default), and every new Code session in that project starts in its own git worktree on a bodega/ branch. The agent edits a copy, and your main folder stays untouched until you apply the result. The file tree, editor, terminal, Source Control and preview all follow the worktree. When you are ready to ship, the new /pr skill makes a feature branch if you are on the default branch, commits the files you named, pushes and opens the pull request, asking you before the push and again before the pull request.
Want the full reference? The Code Mode docs cover Undo, checkpoints and the git tools in detail, and the changelog has everything else in beta.54. If you are new, download Bodega One Code; it is free to use, commercial work included.
Common questions
- How do I undo changes an AI coding agent made?
- In Bodega One Code, open the Changes panel with Ctrl+Shift+D. Use Undo hunk or Undo file for single changes, Undo all for everything, or Checkpoints and then Rewind to put the whole project back as it was before a prompt.
- Can I undo changes made by shell commands and formatters?
- Yes. Since beta.54, Bodega One Code snapshots the whole project folder before every prompt, so Rewind also reverses changes made by shell commands, formatters and sub-agents. Restoring code saves a Before restore checkpoint first, so you can undo the restore.
- Does Rewind change my git history?
- No. Rewind restores files only. Commits, branches and the staging area stay exactly as they are, so revert or reset a commit in Source Control if you want it gone too. The snapshots live in Bodega's own data folder, never in your .git.
- Does Rewind copy my .env files?
- No. Secret-named files such as .env and key files are left out of snapshots, along with git-ignored files, files over 5 MB, node_modules and tool caches. Names are a heuristic, so a secret in an innocently named file can be captured, in a private store on your computer.
- Will the agent push to my main branch?
- No. In beta.54 the agent uses a dedicated git_remote tool that always asks before a pull or push, shows the destination and commit count, and never pushes to main, master or the default branch. A run with nobody watching never pushes.
Written by the Bodega One team. We build Bodega One Code, the local-first AI IDE, and we write here about local models, AI costs, and what we learn shipping it. More about the team and why we build local-first on the about page.
Related posts
Keep learning
Free, vendor-neutral courses and guides in the Bodega One AI Academy, from what a model is to shipping an app.
Stay in the loop
Build-in-public updates, model picks, and Copilot/Cursor news as it breaks.
Follow @BodegaOneAI on X →Ready to own your tools?
Free to use, and the beta is open to everyone. Download free.