shenkonghui/dsh-worktree-manager ↗★ 0

dsh-worktree-manager

Git工作区管理与快速切换插件 适合在开发中需要频繁创建、切换Git工作区的研发人员。

套件
dsh-worktree-manager
相容性
待驗證
版本
0.2.0
最近更新
2026年9月15日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:shenkonghui/dsh-worktree-manager

Usage

  1. Start the dsh web UI
  2. In the task start window, look for the "Worktree" button near the workspace picker
  3. Click it to open the worktree dropdown — it scans all registered workspaces and groups worktrees by repository
  4. To select an existing worktree: expand a repository section, then click a worktree to switch to it
  5. To filter: type in the search box to match worktrees across all repositories by name, branch, or path
  6. To create a new worktree: choose a target repository from the selector (defaults to the current repo), type a new branch name, and click "创建"

The selected/created worktree directory is registered as a dsh workspace and the sidebar switches to it.

合并状态配色

分组开启后,侧边栏里每个 worktree 行的分支徽标会体现它是否已经合回主干:

  • 基准分支 = 该仓库主工作树当前检出的分支(/api/topology 的 mainBranch)。主工作树自身是基准,不参与判定,保持蓝色。
  • 判定方式 = 该 worktree 分支的 tip 是否可从基准到达,即完全合并(git branch --merged );detached HEAD 的 worktree 改用其 HEAD 提交做单点祖先判定(git merge-base --is-ancestor)。合并后又有新提交的算未合并。
  • 绿色 = 已合并到基准;蓝色 = 未合并。
  • 徽标的 hover 提示会写明 已合并到 / 未合并到 。
  • 判不出来时(基准不存在,例如主工作树处于 detached HEAD)不在 /api/topology 的 worktree 行上给 merged 字段:徽标保持蓝色,但提示只显示分支名,不会被误报成「未合并」。

判定在宿主侧完成(/api/topology 的 worktrees[].merged),客户端只负责取色,因此拓扑刷新时状态会一起更新。