Undo changes an agent made
There's no button that undoes an agent's work, but you can ask the agent to undo it, switch back to another branch, or delete a worktree. Commits make going back reliable.
Enjoy doesn’t have a button that undoes an agent’s changes to your project files. How you go back depends on how the work was done.
Ask the agent
The most direct way is to ask, in the same conversation:
- “Undo the changes you made in your last reply.”
- “Put the homepage back the way it was before this conversation.”
If the work was committed, the agent can use Git to bring back exactly what was there before. Give it the commit’s short code from View changes, for example: “Undo commit 3f2a1c9.” If the changes were never committed, the agent has to work out what the files looked like before, which is less reliable.
Check the result before you carry on. See Review the changes an agent made.
If the work is on its own branch
If the agent committed its work on a separate branch, switch back to your main branch in the branch menu. Main is as it was, and the other branch keeps the work in case you want it later. Uncommitted changes come with you when you switch, so ask the agent to commit its work on the other branch first. See Create and switch branches.
If the work is in a worktree
Delete the worktree in the Enjoy computer app. If you haven’t merged it, your main folder never changed. Commits that weren’t merged stay on the worktree’s branch. See Delete a worktree.
If a merge stops because both versions changed the same files, nothing in your main folder changed either.
What doesn’t undo changes
- Stopping an agent keeps the changes it already made.
- Deleting a conversation or marking it completed doesn’t change your project’s files.
If the branch button says Detached
If an agent went back to an earlier commit directly, the branch button can show Detached and a commit code. That means your project isn’t on any branch. To return, choose your branch in the branch menu, or ask the agent to. If the agent made commits while detached, ask it to save them on a branch before you switch.
Set up work so you can go back
- Commit often, or tell your agent to commit after every change. See Save your changes with a commit.
- Try bigger ideas in a worktree or on a new branch. See Try ideas side by side in worktrees.
- Ask for a plan before any changes. Permission modes such as Plan let an agent explore and propose first. See Choose what your agent can do without asking.