worktree-manager
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWorktree Manager
Worktree 管理器
Fast, interactive management of git worktrees with consistent conventions and automatic housekeeping.
基于一致约定与自动清理机制的Git worktree快速交互式管理工具。
Agent behavior contract
Agent行为约定
- Always use when removing worktrees — repos with submodules will fail without it.
--force - Always run after removing a worktree to clean up stale references.
git worktree prune - When creating subfolder worktrees, ensure is in
.worktrees/before creating..gitignore - Never hardcode worktree paths in remove operations — always read from .
git worktree list - Default to subfolder placement unless the user explicitly chooses parent folder.
- Default the worktree folder name to the last segment of the branch name.
- 删除worktree时始终使用参数——包含子模块的仓库若不使用该参数会操作失败。
--force - 删除worktree后务必运行命令以清理过期引用。
git worktree prune - 创建子文件夹式worktree时,需先将添加至
.worktrees/再执行创建操作。.gitignore - 删除操作中切勿硬编码worktree路径——始终从命令的输出中读取路径。
git worktree list - 默认采用子文件夹放置方式,除非用户明确选择父文件夹放置。
- worktree文件夹名称默认使用分支名称的最后一段。
Triage (detect action)
分类处理(检测操作)
If the user provided an argument (create, list, or remove), use that action.
If no argument was provided, ask the user which action they want:
- create — Create a new worktree with a new branch
- list — List all current worktrees
- remove — Remove an existing worktree
Then read the appropriate reference:
若用户提供了操作参数(create、list或remove),则执行对应操作。
若未提供参数,则询问用户需要执行的操作:
- create — 创建带有新分支的worktree
- list — 列出所有当前的worktree
- remove — 删除已有的worktree
之后读取对应的参考文档:
Routing map
路由映射
- Creating a worktree →
references/creating.md - Listing worktrees →
references/listing.md - Removing a worktree →
references/removing.md - Placement strategies & conventions →
references/placement.md - Common issues & troubleshooting →
references/troubleshooting.md
- 创建worktree →
references/creating.md - 列出worktrees →
references/listing.md - 删除worktree →
references/removing.md - 放置策略与约定 →
references/placement.md - 常见问题与故障排查 →
references/troubleshooting.md
Common errors → next best move
常见错误→最佳解决步骤
- "working trees containing submodules cannot be moved or removed" → use flag (see
--force)references/removing.md - Stale worktree references after manual deletion → run (see
git worktree prune)references/removing.md - Branch already checked out in another worktree → list worktrees to find which one, remove or use a different branch
- showing up in git status → add to
.worktrees/(see.gitignore)references/placement.md
- "working trees containing submodules cannot be moved or removed" → 使用标记(详见
--force)references/removing.md - 手动删除后存在过期worktree引用 → 运行命令(详见
git worktree prune)references/removing.md - 分支已在另一个worktree中检出 → 列出所有worktree以找到对应项,删除该worktree或使用其他分支
- 出现在git状态中 → 将其添加至
.worktrees/(详见.gitignore)references/placement.md