creating-worktrees
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreating Worktrees
创建 Worktree
Steps
步骤
- Find repo root: .
git rev-parse --show-toplevel - Get branch or task name; ask once if missing.
- Sanitize slug: replace , spaces, unusual chars with
/.- - Add to
.worktrees/if missing.$(git rev-parse --git-path info/exclude) - Create: existing branch → ; new branch →
git worktree add <path> <branch>.git worktree add -b <branch> <path> - only when source has
codegraph init <path>or user asks. Else.codegraph/.CodeGraph: not applicable - Report path, branch, exclude status, CodeGraph result.
- 查找仓库根目录:。
git rev-parse --show-toplevel - 获取分支或任务名称;如果缺失,则询问一次。
- 清理 slug:将 、空格和异常字符替换为
/。- - 如果尚未添加,则将 添加到
.worktrees/。$(git rev-parse --git-path info/exclude) - 创建:已有分支 → ;新分支 →
git worktree add <path> <branch>。git worktree add -b <branch> <path> - 仅当源目录包含 或用户提出要求时,才执行
.codegraph/。否则输出codegraph init <path>。CodeGraph: not applicable - 报告路径、分支、排除状态和 CodeGraph 结果。
Output
输出
End with a short report covering path/branch, , , , and status.
ReportSanitized slugWorktree existsExclusionCodeGraphCompletion: worktree exists, branch correct, exclusion recorded, CodeGraph reported.
最后以一份简短报告结束,涵盖 路径/分支、、、 和 状态。
ReportSanitized slugWorktree existsExclusionCodeGraph完成条件:worktree 存在、分支正确、已记录排除项、已报告 CodeGraph。