> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Devin Local Worktrees

> Run a Devin Local session in a new or existing git worktree in Devin Desktop, then merge its changes back into your main workspace.

You can run a Devin Local session inside a git worktree, so the agent can edit, build, and test without touching your main workspace.

Open the **Worktree** submenu in the agent location selector when you start a session:

* **New worktree** — Devin Desktop creates a fresh worktree for the session.
* **Existing worktree** — choose one from the list under **New worktree** in the same submenu.

When the agent is done, go to the **IDE view**. Click **Merge** in the changes toolbar above the input box. This action brings the worktree's changes back into your workspace.

> [!NOTE]
>
> You can only pick a worktree at the beginning of a session. Conversations cannot be moved to a different worktree once started.

## Location

Worktrees are organized by repo name inside `~/.windsurf/worktrees/<repo_name>`. Each worktree is given a unique random name.

To see a list of active worktrees, run `git worktree list` from within the repository directory.

> [!WARNING]
>
> Because worktrees live in a different directory than your original project, **build systems or tools that rely on relative paths** (e.g., `../shared-lib` references, symlinked dependencies, or monorepo source dependencies resolved by path) may break inside a worktree.

## Cleanup

Devin Desktop does not remove other worktrees when you create a new worktree. A workspace does not have a worktree limit.

When you delete a session, Devin Desktop keeps the worktree of that session.

To remove a worktree, run `git worktree remove <path>` from the repository directory. This command does not delete the branch of the worktree.

## Source Control Panel

By default, Devin Desktop does not show agent-created worktrees in the Source Control panel. Set `git.showDevinWorktrees` to `true` in your settings to show them.

> [!NOTE]
>
> The older `git.showWindsurfWorktrees` setting is deprecated. It is still honored for existing configurations when `git.showDevinWorktrees` is not set, but use `git.showDevinWorktrees` going forward.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.