> ## 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.

Pick the location from the agent location selector when starting a session:

* **New worktree** — Devin Desktop creates a fresh worktree for the session.
* **Existing worktree** — choose one you already have from the selector's **Local** submenu.

Once the agent is done, click **Merge** on the session to bring 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 automatically cleans up older worktrees when creating a new worktree to prevent excessive disk usage. Each workspace can have up to **20** worktrees.

Worktrees are cleaned up based on when they were last accessed — the oldest ones are removed first. This cleanup happens on a per-workspace basis, so worktrees from different repositories remain independent of each other.

If you delete a session, Devin Desktop also deletes the associated 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.