| name | worktree |
| description | Manage git worktrees for parallel feature development. Sub-commands: create, sync, cleanup |
Git Worktree Manager
Create, sync, and clean up git worktrees for isolated feature development.
Usage
/worktree create <feature-name> [base-branch]
/worktree sync [base-branch]
/worktree cleanup <feature-name> [--force]
Instructions
Parse the first argument as the sub-command and dispatch accordingly.
If no sub-command is provided, display:
Usage:
/worktree create <feature-name> [base-branch] — create new isolated worktree
/worktree sync [base-branch] — sync current worktree with base
/worktree cleanup <feature-name> [--force] — remove worktree after merge
Sub-command: create
Create a new git worktree for isolated feature development with automatic plan setup.
When to use: Starting a new feature that needs multiple commits, working on multiple features in parallel, or keeping the main branch clean during development.
Step 1: Validate Inputs
Ensure feature name is provided (second argument). Convert to kebab-case:
FEATURE_NAME=$(echo "$2" | tr '[:upper:]' '[:lower:]' | tr '_' '-' | tr ' ' '-')
Step 2: Determine Base Branch
Use third argument if provided, otherwise detect main or master from git refs.