worktree
创建和管理 Git 工作树,用于并行开发。当用户需要创建工作树、独立开发功能、设置带有独立目录的新分支或管理现有工作树时使用。
📖 中文导读:创建和管理 Git 工作树,用于并行开发。当用户需要创建工作树、独立开发功能、设置带有独立目录的新分支或管理现有工作树时使用。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: worktree description: Create and manage git worktrees for parallel development. Use when the user wants to create a worktree, work on a feature in isolation, set up a new branch with its own directory, or manage existing worktrees. allowed-tools: Bash(bin/worktree:), Bash(git worktree:)
Git Worktree Management
Manage git worktrees using the bin/worktree script for parallel development workflows.
Available Commands
bin/worktree list # Show all worktrees
bin/worktree create <branch> # Create worktree for branch
bin/worktree delete <branch> # Remove worktree
bin/worktree go <branch> # Print path (for cd)
Naming Convention
Worktrees are created as sibling directories to the main repo. Slashes become dashes:
| Branch | Directory |
|---|---|
feature/auth |
../jolly-blitzen-feature-auth |
bugfix/login |
../jolly-blitzen-bugfix-login |
experiment/new-ui |
../jolly-blitzen-experiment-new-ui |
Instructions
When creating a worktree:
- If user provides a branch name (contains
/), use it directly - If user provides a task description, convert to
feature/<kebab-case-description> - Run
bin/worktree create <branch> - Tell the user the path and how to switch:
cd <path>
When listing worktrees:
Run bin/worktree list and present the results.
When deleting a worktree:
- Confirm the branch name with the user if ambiguous
- Run
bin/worktree delete <branch>
Examples
User: "Create a worktree for adding user notifications"
bin/worktree create feature/user-notifications
User: "Set up a worktree for branch bugfix/login-issue"
bin/worktree create bugfix/login-issue
User: "Show me my worktrees"
bin/worktree list
User: "Remove the notifications worktree"
bin/worktree delete feature/user-notifications