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

# Devin Local 工作树

> 在 Devin Desktop 中，于新建或现有的 git worktree 中运行 Devin Local 会话，再将其更改合并回您的主 workspace。

你可以在 git worktree 中运行 Devin Local 会话，让智能体在不影响您的主 workspace 的情况下进行编辑、构建和测试。

开始会话时，在智能体位置选择器中打开 **Worktree** 子菜单：

* **New worktree** — Devin Desktop 会为该会话新建一个 worktree。
* **Existing worktree** — 从同一子菜单中 **New worktree** 下方的列表里选择一个。

智能体完成工作后，切换到 **IDE view**，点击输入框上方更改工具栏中的 **Merge**，即可将 worktree 中的更改合并回您的 workspace。

> [!NOTE]
>
> 只能在会话开始时选择 worktree。对话开始后，无法再将其移至其他 worktree。

## 位置

工作树按代码仓库名称存放在 `~/.windsurf/worktrees/<repo_name>` 下，每个 worktree 都会分配一个唯一的随机名称。

要查看活跃工作树列表，请在代码仓库目录中运行 `git worktree list`。

> [!WARNING]
>
> 由于工作树与您的原始项目位于不同目录，**依赖相对路径的构建系统或工具** (例如 `../shared-lib` 引用、通过符号链接引入的依赖，或按路径解析的单体仓库源码依赖) 在 worktree 中可能会失效。

## 清理

创建新的 工作树 时，Devin Desktop 不会移除其他 工作树。workspace 中的 工作树 数量没有上限。

删除会话后，Devin Desktop 仍会保留该会话的 工作树。

如需移除 工作树，请在代码仓库目录下运行 `git worktree remove <path>`。此命令不会删除该 工作树 对应的分支。

## 源代码管理面板

默认情况下，Devin Desktop 不会在源代码管理面板中显示智能体创建的工作树。如需显示，请在您的设置中将 `git.showDevinWorktrees` 设为 `true`。

> [!NOTE]
>
> 旧版 `git.showWindsurfWorktrees` 设置已弃用。在未设置 `git.showDevinWorktrees` 的情况下，现有配置中的该设置仍然有效，但今后请改用 `git.showDevinWorktrees`。


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