dsh-git-worktree
Conversation↔worktree binding for DeepSeek Harness: one-click isolated worktree + branch per conversation, with a binding manager panel
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:KHG420/git-worktree说明文档
阅读完整 README ↗dsh-git-worktree
面向 DeepSeek Harness 的 对话 ↔ 工作树绑定 插件:让多个会话在同一项目上并行工作,每个会话绑定一个独立 git 工作树 + 分支,一键创建、互不干扰。
Conversation↔worktree binding for DeepSeek Harness: run multiple conversations on one project in parallel, each bound to its own isolated git worktree + branch, created in one click.
- 绑定 / Binding — 会话在创建时即绑定到专属工作树:工作树 + 工作区 + 会话一次成型(绑定关系可推导、可展示、可清理)。
- Agent 工具 / Agent tools — 9 个工具(
git_session_binding、git_repo_status、git_worktree_*、git_branch_*),每个会话都可以调用。 9 tools (git_session_binding,git_repo_status,git_worktree_*,git_branch_*) every conversation can call. - 浏览器面板 / Browser panel — 侧边栏的 Bindings 入口:绑定管理器,列出工作树及其绑定的会话,一键创建绑定会话,删除时警告并可选归档绑定会话。 A sidebar Bindings entry: the binding manager — lists worktrees with their bound conversations, creates a bound conversation in one click, and warns about (optionally archiving) bound conversations on removal.
绑定是什么 / What a binding is
DSH 中,会话的工作目录(cwd)在创建时冻结,工作区归属要求"会话 cwd == 工作区路径"。因此绑定只能在创建会话的那一刻发生——把会话建在专属工作树里,绑定关系即成立:
A DSH session's cwd is frozen at creation and workspace membership requires the session's canonical cwd to equal the workspace path. So a binding happens at creation time: the conversation is born inside its own worktree:
~/projects/foo/ ← 主工作树 / primary worktree (main)
├── .dsh-wt/
│ ├── feature-a/ ← 会话 A 绑定 / conversation A is bound here (branch feature-a)
│ └── bugfix-b/ ← 会话 B 绑定 / conversation B is bound here (branch bugfix-b)
└── (共享同一个 .git / one shared .git)
绑定关系无需额外存储,由 sessions.list(cwd)× git worktree list(路径→分支)× workspaces.list 推导而来——面板和 agent 工具看到的都是实时事实。
Bindings are derived, not stored: sessions.list (cwd) × git worktree list (path→branch) × workspaces.list — what the panel and the agent tools show is live fact.
一键创建绑定会话 / One-click bound conversation
在面板输入 repo 路径(默认取当前会话工作区)和功能名,点 创建绑定会话:
git worktree add -b /.dsh-wt/(重名自动加后缀-2、-3…)- (幂等注册工作区)