Agent Skills › looplj/reveric › worktree

worktree

GitHub

规范 Git worktree 的目录位置、命名规则及操作命令,支持并行开发、紧急修复与代码审查。

.agents/skills/worktree/SKILL.md looplj/reveric

Trigger Scenarios

Git worktree 使用指南 多分支并行开发管理 Git worktree 创建与管理

Install

npx skills add looplj/reveric --skill worktree -g -y
More Options

Non-standard path

npx skills add https://github.com/looplj/reveric/tree/unstable/.agents/skills/worktree -g -y

Use without installing

npx skills use looplj/reveric@worktree

指定 Agent (Claude Code)

npx skills add looplj/reveric --skill worktree -a claude-code -g -y

安装 repo 全部 skill

npx skills add looplj/reveric --all -g -y

预览 repo 内 skill

npx skills add looplj/reveric --list

SKILL.md

Frontmatter
{
    "name": "worktree",
    "description": "Git worktree 管理规范与操作指南。Invoke when user asks about git worktree, parallel development, or managing multiple branches."
}

Git Worktree 规范

Worktree 目录位置

  • 所有 worktree 统一放置在 <project-parent-path>/<project-name>-worktrees/ 目录下。
  • 主仓库位于 <project-parent-path>/<project-name>/,不作为 worktree 使用。

Worktree 命名规则

  • Worktree 目录命名格式:{branch-name} 或 {feature/branch-name},保持与分支名称一致。
  • 示例:
    • 分支 feature/ai-chat → worktree 路径 <project-parent-path>/<project-name>-worktrees/feature-ai-chat
    • 分支 bugfix/layout-overflow → worktree 路径 <project-parent-path>/<project-name>-worktrees/bugfix-layout-overflow
    • 分支 develop → worktree 路径 <project-parent-path>/<project-name>-worktrees/develop

Worktree 使用场景

  • 并行开发多个功能:在不同 worktree 中同时开发不同功能,无需频繁切换分支。
  • 紧急修复:在独立 worktree 中处理紧急 bug,不影响当前开发进度。
  • 代码审查:在独立 worktree 中检出他人分支进行测试和审查。
  • 长期维护分支:为长期存在的分支(如 develop、staging)创建独立 worktree。

Worktree 操作命令

创建 Worktree

# 创建新分支并创建 worktree
git worktree add <project-parent-path>/<project-name>-worktrees/feature-xyz -b feature/xyz

# 为已存在的分支创建 worktree
git worktree add <project-parent-path>/<project-name>-worktrees/develop develop

# 基于远程分支创建 worktree
git worktree add <project-parent-path>/<project-name>-worktrees/feature-abc origin/feature/abc

管理 Worktree

# 列出所有 worktree
git worktree list

# 在指定 worktree 中执行命令
cd <project-parent-path>/<project-name>-worktrees/feature-xyz
git status

# 删除 worktree(需先确保分支已合并或不再需要)
git worktree remove <project-parent-path>/<project-name>-worktrees/feature-xyz

# 清理已删除分支的 worktree 引用
git worktree prune

Worktree 最佳实践

  1. 功能开发完成后及时清理:分支合并后立即删除对应的 worktree。
  2. 命名清晰:worktree 目录名应能清晰反映对应分支的用途。
  3. 独立测试环境:每个 worktree 可以运行独立的测试实例,避免相互干扰。
  4. 文档同步:在 worktree 中修改文档时,注意主仓库和其他 worktree 的同步。

Version History

  • ca297eb Current 2026-11-02 08:45

Same Skill Collection

.agents/skills/cineview-design/SKILL.md
.agents/skills/domain-modeling/SKILL.md
.agents/skills/flutter-build-responsive-layout/SKILL.md
.agents/skills/flutter-fix-layout-issues/SKILL.md
.agents/skills/git/SKILL.md
.agents/skills/grilling/SKILL.md
.agents/skills/handoff/SKILL.md
.agents/skills/humanizer-zh/SKILL.md
.agents/skills/hunt/SKILL.md
.agents/skills/patrol/SKILL.md
.agents/skills/profile/SKILL.md
.agents/skills/riverpod/SKILL.md
.agents/skills/sqlite/SKILL.md
.agents/skills/tdd/SKILL.md
.agents/skills/think/SKILL.md
.agents/skills/write/SKILL.md
assets/official_skills/map-design/SKILL.md
assets/official_skills/screenplay-production/SKILL.md
assets/official_skills/screenplay-writing/SKILL.md
designs/desktop/SKILL.md
.agents/skills/baoyu-design/SKILL.md
.agents/skills/impeccable/SKILL.md
assets/bundled_skills/canvas-composition/SKILL.md
assets/bundled_skills/management/SKILL.md
assets/bundled_skills/media-editing/SKILL.md
assets/bundled_skills/screenplay-tools/SKILL.md
assets/bundled_skills/setup/SKILL.md
assets/bundled_skills/story-continuity/SKILL.md
.agents/skills/grill-me/SKILL.md
.agents/skills/grill-with-docs/SKILL.md

Metadata

Files
0
Version
ca297eb
Hash
5208acc2
Indexed
2026-11-02 08:45

홈 - 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-11-03 01:09
浙ICP备14020137号-1