team-worktree

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Team Worktree

团队 Worktree

Before finalizing prose you author, read the writing standards.
Create one isolated git worktree per involved repo, all on branch
<id>
, without touching any main working tree: the home repo in single-repo mode (default), or every repo in
docs/plans/<id>/4-repos.md
when it exists.
在最终确定你撰写的文字之前,请阅读写作规范。
为每个涉及的仓库创建一个隔离的 Git worktree,全部使用
<id>
分支,且不得修改任何主工作树:在单仓库模式(默认)下使用 home repo;当
docs/plans/<id>/4-repos.md
存在时,则为其中列出的每个仓库创建 worktree。

Core contracts

核心约定

  • Detect a linked checkout with
    git rev-parse --git-dir
    and
    git rev-parse --git-common-dir
    .
  • Non-default branch in an existing linked checkout → skip worktree creation for this repo.
  • Default branch → report and stop.
  • Single-repo:
    git worktree add .claude/worktrees/<branch>
    . Each
    4-repos.md
    entry:
    git -C <repo> worktree add .claude/worktrees/<branch>
    .
  • Record every created path under
    ## Worktrees
    in
    4-repos.md
    .
  • 使用
    git rev-parse --git-dir
    和
    git rev-parse --git-common-dir
    检测关联 checkout。
  • 现有关联 checkout 位于非默认分支 → 跳过为此仓库创建 worktree。
  • 位于默认分支 → 报告并停止。
  • 单仓库模式:
    git worktree add .claude/worktrees/<branch>
    。每个
    4-repos.md
    条目:
    git -C <repo> worktree add .claude/worktrees/<branch>
    。
  • 在
    4-repos.md
    的
    ## Worktrees
    下记录每个已创建的路径。

Procedure references

流程参考

Read each reference completely when reaching it, in order; later stages depend on earlier state and gates.
  1. Input
  2. Detect mode
  3. Detect existing worktree
  4. Execution
到达每个步骤时,按顺序完整阅读对应的参考文档;后续阶段依赖先前阶段的状态和关卡。
  1. 输入
  2. 检测模式
  3. 检测现有 worktree
  4. 执行