GitKraken Desktop Documentation

Review and Undo AI Coding Agent Changes in GitKraken Desktop

Last updated: November 2026

Use this page to see exactly what an AI coding agent changed in your repository and to undo those changes safely if something went wrong. It works with any agent that edits files in a Git repository. GitKraken Desktop reads the changes from Git, so it does not matter which agent made them.

Requirements and limits

  • Scope: Reviewing and reversing an agent’s changes, whether they are uncommitted, committed on your machine, or pushed
  • Prerequisite: The repository the agent worked in is open in GitKraken Desktop. The steps work for sessions started from the Agents view and for agents you run yourself.
  • Limits: Git does not record whether a person or an agent wrote a change, so give each agent its own session or branch.
  • Limits: AI summaries require a paid GitKraken subscription. Reviewing diffs and undoing changes do not.

Discarding changes and hard resets remove work from the worktree you have open, including uncommitted changes that are not the agent’s. Review the diff first.


Quick Start

Before you undo anything, open the agent’s worktree: in the Agents view, right-click the session card and select Open this worktree. Discard, restore, reset, and revert all act on the worktree you have open.

Then find where the agent’s changes are and use the matching row.

Where the changes are How to see them How to undo them Safe after you push? Notes
Uncommitted, in the agent’s worktree Open the agent’s worktree, click its WIP node, then click a file Discard all or selected files, or revert one hunk Not applicable Discarded changes leave the worktree
Committed on the agent’s branch, not pushed Shift + click the agent’s first and last commits for a combined diff of the range Reset the branch to the last good commit No Reset rewrites the branch’s history
Committed and pushed Select the agent’s commits in the Commit Graph Revert commit on each one, then push Yes Revert adds new commits and keeps existing history
Only one or two files are damaged Open the file’s History Restore file from this commit Yes The restored file arrives as a staged change
Anywhere in a session you do not want Check the session card in the Agents view Remove worktree and delete branch No Deletes the branch even if its commits are not merged

Before the agent starts: give it its own branch

Isolated changes are the easiest to review. When you start a session from the Agents view, GitKraken Desktop creates a new branch in its own worktree, so the agent’s work stays separate from yours.

If you run an agent outside the Agents view, create a branch or worktree for it first. Then everything on that branch is the agent’s work, and undoing it never touches your own changes.


How to see what an agent changed

Where you look depends on whether the agent committed its work.

See uncommitted changes

GitKraken Desktop shows a separate WIP row in the Commit Graph for each other worktree that has uncommitted changes or an active agent session. Rows for agent sessions show the agent’s logo and current status. To hide these rows, clear Show worktree WIP nodes in the graph in the Agents section of Repo-Specific Preferences.

Commit Graph showing a separate WIP node for each of several worktrees with pending changes.
Each worktree, including each agent session, gets its own WIP node.

Selecting another worktree’s WIP row does not open its files in the Commit Panel. Open the worktree first:

  1. In the Agents view, check the session card for the branch, WIP changes, and ahead and behind counts.
  2. Open the agent’s worktree. Select its WIP row in the Commit Graph and click Open Worktree, or double-click the row.
  3. Click the WIP node of the worktree you now have open. The Commit Panel lists every file the agent changed.
  4. Click a file to open its diff. Use Hunk view to step through each changed block, or Split view to see the old and new versions side by side.

See commits the agent made

  1. Click a commit on the agent’s branch, then click any file in the Commit Panel to see what that commit changed.
  2. To see everything the agent committed at once, hold Shift and click the first and last of its commits. The Commit Panel shows Viewing diff of [number] commits, the list of selected commits, and the files changed across them. If the range ends at the commit you have checked out, you can include the WIP node too.

To compare 2 specific commits, hold Cmd (Mac) or Ctrl (Windows/Linux) and click each one. A combined diff of 3 or more items needs a contiguous range. For any other selection, the Commit Panel explains that a combined diff is not shown.

The Commit Panel titled "Viewing diff of 3 commits", listing three commits by Alex Lee with their dates and short SHAs, then 2 modified and 3 added files: docs/CONTRIBUTING.md, three files under docs/onboarding/ and README.md.
Select a range of commits to review an agent’s work as one combined diff.

To compare the agent’s uncommitted work with another branch, open the agent’s worktree. Then right-click main, or whichever branch you want to compare against, in the Commit Graph and select Compare commit against working directory.

Trace a single line

Open a file’s diff and click Blame to see which commit last changed each line, or History to see every commit that touched the file. Blame and History help when an agent changed a file several times during one session.

Get a summary with GitKraken AI

Right-click the agent’s branch and select Explain Branch Changes to get a plain-language summary of everything on the branch. To explain specific commits, select 1 or 2 commits or a contiguous range. In the top-right corner of the Commit Panel, click Explain commit or Explain commits. If the AI button shows a Recompose label instead, open its menu and select the Explain option.

A summary helps you decide where to look first, but it is not a review. Read the diff before you keep or undo anything. See GitKraken AI for details.


How to undo an agent’s changes

Pick the method based on where the changes are. Committed changes need more care to undo than uncommitted ones, and pushed changes need the most.

Undo uncommitted changes

To throw away everything the agent changed but did not commit:

  1. Open the agent’s worktree.
  2. Select the agent’s WIP node.
  3. Click the trash icon to discard all changes, or select specific files, right-click, and select Discard [number] files.

To keep most of the agent’s work and undo one block, open the file’s diff in Hunk view and click Revert Hunk next to that hunk. GitKraken Desktop applies the opposite change to your working directory. Reverting a hunk changes uncommitted files only. It’s different from Revert commit, which adds a new commit that reverses an earlier one.

GitKraken Desktop diff view in Hunk mode with the Revert button next to a changed block.
Revert a single hunk and keep the rest of the agent’s changes.

See Stage, Unstage, and Ignore Files for line-level options.

Bring back an earlier version of a file

If the agent damaged one or two files, restore them instead of undoing everything:

  1. Open the agent’s worktree.
  2. Open the file’s diff and click History. Find the last commit that changed the file before the agent started.
  3. Select that commit in the Commit Graph.
  4. In the Commit Panel, right-click the file and select Restore file from this commit.

The file arrives in your working directory as a staged change, ready to commit. If you already have uncommitted changes to that file, GitKraken Desktop asks before it overwrites them.

Undo commits that are only on your machine

If the agent committed work you have not pushed, reset its branch to the last good commit:

  1. Open the agent’s worktree.
  2. Right-click the last commit you want to keep.
  3. Select Reset [branch] to this commit, then choose a reset type:
    • Soft keeps the agent’s changes staged, so you can review them and recommit only what you want.
    • Mixed keeps the changes in your working directory, unstaged.
    • Hard removes the agent’s commits and every uncommitted change in the worktree.

Hard also deletes uncommitted changes in that worktree that the agent did not make. If you might want to keep any part of the work, start with Soft or Mixed.

See How to reset commits for more on reset types.

Undo commits you already pushed

Once the agent’s commits are on a shared branch, do not reset. Reverse them with new commits instead, so nobody else’s history changes:

  1. Open the agent’s worktree.
  2. Right-click the agent’s newest commit in the Commit Graph and select Revert commit. GitKraken Desktop creates a new commit that undoes it.
  3. Repeat for each commit you want to reverse, from newest to oldest.
  4. Push the branch to share the revert commits.
Commit Graph context menu in GitKraken Desktop with the Revert Commit option highlighted.
Revert creates a new commit, so shared history stays intact.

Throw away a whole agent session

If you do not want any of the session’s work, right-click the session card in the Agents view and select Remove worktree and delete branch, then confirm. GitKraken Desktop stops the agent’s terminal session and deletes the worktree, its working directory, and the local branch. It deletes the branch even if its commits are not merged anywhere, and you cannot undo this.

If the worktree still has uncommitted changes, GitKraken Desktop asks you to confirm again with Force Remove Worktree. The remote branch stays unless you choose Remove worktree and delete branch (local & remote) instead. If other people use the pushed branch, revert its commits instead of deleting it.

See Clean Up AI Coding Agent Worktrees and Branches for more on removing worktrees.


How to recover from a cleanup mistake

If you discard or reset the wrong thing while cleaning up after an agent, click Undo in the toolbar or press Cmd + Z (Mac) or Ctrl + Z (Windows/Linux) right away. Undo reverses the most recent supported action, such as a commit, a discard, or a branch reset, as long as it happened on your machine and has not been pushed. That includes commits and resets an agent made from its terminal, as long as you have the agent’s worktree open. Undo is not available while a merge or rebase is in progress.

Undo reverses one action at a time, starting with the most recent. To reverse a series of agent commits, or commits you already pushed, use reset or revert, as in Undo commits that are only on your machine and Undo commits you already pushed. See Undo and Redo for the full list of supported actions.


Common questions

Answers to frequent questions about reviewing and undoing agent changes.

Can GitKraken Desktop tell which changes an agent made?

No. Git does not record whether a person or an agent wrote a change. GitKraken Desktop shows changes by branch and worktree, so when each agent works in its own session, its branch and WIP node show only that agent’s work.

Which agents does this work with?

Any agent that edits files in a Git repository. The Agents view integrates with Claude Code, Codex CLI, Copilot CLI, Cursor CLI, Gemini CLI, and OpenCode, and you can run other agents in the embedded terminal. You review and undo changes from all of them the same way.

Should I use a hard reset to undo an agent?

Only for commits that exist on your machine alone, and only after you’ve reviewed the diff. A hard reset also deletes every uncommitted change in the worktree. For anything already pushed, use Revert commit.

Can I keep some of the agent’s work and undo the rest?

Yes. Revert individual hunks, restore individual files, or use a Soft reset to put the agent’s changes back in staging so you can commit only the parts you want.


Related pages

Have feedback about this article? Did we miss something? Let us know!
On this page