git-worktree — git-worktree install git-worktree, community, git-worktree install, ide skills, Claude Code, Cursor, Windsurf

v1.0.0
GitHub

About this Skill

Perfect for Development Agents needing efficient Git worktree management and automation. git-worktree is a Git management command that allows users to create, list, and remove worktrees, streamlining project development and branch management.

Features

Creates new worktrees using the `/git-worktree init` command
Lists all existing worktrees with the `/git-worktree list` command
Removes worktrees using the `/git-worktree remove` command
Automatically infers branch type based on user task description
Supports integration with iTerm2 for seamless workflow

# Core Topics

opensrcdevelop opensrcdevelop
[1]
[0]
Updated: 3/4/2026

Agent Capability Analysis

The git-worktree skill by opensrcdevelop is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance. Optimized for git-worktree install.

Ideal Agent Persona

Perfect for Development Agents needing efficient Git worktree management and automation.

Core Value

Empowers agents to manage Git worktrees efficiently, supporting creation, listing, and deletion operations using Git commands, and integrates with iTerm2 for seamless workflow automation, utilizing protocols like command-line interfaces.

Capabilities Granted for git-worktree

Automating worktree creation for new projects
Listing and managing existing worktrees for multiple branches
Deleting unused worktrees to maintain repository organization

! Prerequisites & Limits

  • Requires Git installation and configuration
  • Limited to Git worktree management, not comprehensive Git repository management
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

git-worktree

Unlock efficient Git worktree management with our AI agent skill, featuring init, list, and remove commands - learn how to get started today!

SKILL.md
Readonly

Git Worktree 管理命令 (v1.0.0)

管理项目中的 Git worktree,支持创建、列表查看和删除操作。

调用方式

/git-worktree init "任务描述"   # 创建 worktree
/git-worktree list             # 列出所有 worktree
/git-worktree remove           # 删除 worktree

命令详解

init - 创建新的 Worktree

根据用户描述的任务,自动推断分支类型并创建 worktree。创建完成后询问用户是否要在 iTerm2 中打开新 tab 并启动 Claude。

调用方式:

/git-worktree init "任务描述"

参数说明:

  • 任务描述 - 任务的简短描述(必需)

交互流程:

  1. 执行脚本创建 worktree
  2. 脚本输出 [ASK_USER_OPEN_ITERM] 标记和信息
  3. AI 检测到标记后,使用 AskUserQuestion 询问用户是否打开 iTerm2
  4. 用户同意后,执行以下命令打开 iTerm2:
bash
1cd /Users/lee0407/dev/projs/auth && python3 .claude/skills/git-worktree/scripts/open_iterm.py "<worktree_path>" "<branch_name>" "<description>"

自动推断的分支类型:

关键词分支类型
feat, 功能, 添加, 新增, 实现feature
fix, 修复, bug, 错误, 问题bugfix
refactor, 重构, 优化, 重写refactor
docs, 文档, 说明, readmedocs
test, 测试, 单元test
chore, 配置, 构建, 依赖chore

执行流程:

  1. 切换到 develop 分支并拉取最新代码
  2. 根据描述推断分支类型并生成分支名
  3. 创建新分支
  4. worktrees/ 目录下创建 worktree
  5. 切换回 develop 分支
  6. 输出 [ASK_USER_OPEN_ITERM] 标记,等待 AI 询问用户

使用示例:

/git-worktree init "添加用户 Excel 导入导出功能"
# 结果:创建 feature/excel-import-export 分支和 worktree
#       AI 检测到 [ASK_USER_OPEN_ITERM] 标记
#       AI 使用 AskUserQuestion 询问用户
#       用户同意后执行 open_iterm.py 打开 iTerm2 并启动 Claude

AI 响应规则

当执行 /git-worktree init 后,脚本会输出 [ASK_USER_OPEN_ITERM] 标记。AI 应:

  1. 检测到 [ASK_USER_OPEN_ITERM] 标记
  2. 解析标记后的信息(格式:path|branch|description
  3. 使用 AskUserQuestion 询问用户
json
1{ 2 "questions": [ 3 { 4 "question": "是否要在 iTerm2 中打开新 tab 并启动 Claude?", 5 "header": "iTerm2", 6 "options": [ 7 {"label": "是,打开 iTerm2", "description": "在 iTerm2 新 tab 中启动 Claude"}, 8 {"label": "否,稍后手动打开", "description": "不打开,稍后自行执行"} 9 ], 10 "multiSelect": false 11 } 12 ] 13}
  1. 用户选择"是"后,执行:
bash
1cd /Users/lee0407/dev/projs/auth && python3 .claude/skills/git-worktree/scripts/open_iterm.py "<worktree_path>" "<branch_name>" "<description>"

脚本说明

worktree_manager.py

主脚本,处理 worktree 的创建、列表和删除操作。

open_iterm.py

辅助脚本,用于在 iTerm2 中打开新 tab 并启动 Claude。

命令详解

list - 列出所有 Worktree

显示当前仓库中所有 worktree 的列表。

调用方式:

/git-worktree list

输出格式:

Git Worktree 列表
============================================================
主 /Users/lee0407/dev/projs/auth                    [develop] ✓
└─ worktrees/feature-excel-import              [feature/excel-import] ✓
└─ worktrees/bugfix-login-issue                [bugfix/login-issue] ✗
============================================================
✓ = 干净工作区 | ✗ = 有未提交更改

使用示例:

/git-worktree list

remove - 删除 Worktree

交互式删除指定的 worktree。

调用方式:

/git-worktree remove           # 交互式选择
/git-worktree remove 1         # 按索引删除
/git-worktree remove feature-xxx  # 按路径删除

注意事项:

  • 不会删除主目录的 worktree
  • 不会删除有未提交更改的 worktree(除非强制)

使用示例:

/git-worktree remove
# 显示可删除的 worktree 列表,供用户选择

工作原理

Git Worktree 允许在同一个仓库中同时在多个分支上工作:

auth/
├── .git/
├── worktrees/
│   ├── feature-excel-import/     # 功能开发 worktree
│   └── bugfix-login-issue/       # Bug 修复 worktree
├── auth-biz/
├── auth-server/
└── ...

最佳实践

  1. 每个任务一个 worktree - 保持工作区干净
  2. 及时清理 - 任务完成后删除不需要的 worktree
  3. 描述清晰 - 使用有意义的任务描述便于识别
  4. 先更新 develop - 创建前确保 develop 是最新的

注意事项

  1. 所有 worktree 必须创建在 worktrees/ 目录下
  2. 创建前会自动检查 develop 分支是否为最新
  3. 删除前会询问用户确认
  4. 不会删除主目录的 worktree

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is git-worktree?

Perfect for Development Agents needing efficient Git worktree management and automation. git-worktree is a Git management command that allows users to create, list, and remove worktrees, streamlining project development and branch management.

How do I install git-worktree?

Run the command: npx killer-skills add opensrcdevelop/auth/git-worktree. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for git-worktree?

Key use cases include: Automating worktree creation for new projects, Listing and managing existing worktrees for multiple branches, Deleting unused worktrees to maintain repository organization.

Which IDEs are compatible with git-worktree?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for git-worktree?

Requires Git installation and configuration. Limited to Git worktree management, not comprehensive Git repository management.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add opensrcdevelop/auth/git-worktree. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use git-worktree immediately in the current project.

Related Skills

Looking for an alternative to git-worktree or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI