Git worktree patterns for parallel development. Use when working on multiple branches simultaneously or when you need to maintain separate working directories for different branches.
Provides Git worktree patterns for parallel development across multiple branches. Use when you need to work on multiple features simultaneously, review PRs without stashing changes, or handle urgent hotfixes while continuing development.
/plugin marketplace add L-Sypniewski/claude-code-toolkit/plugin install git-project-management@claude-code-toolkitThis skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill provides patterns for using Git worktrees to enable parallel development across multiple branches.
Git worktrees allow you to have multiple working directories attached to the same repository. Each worktree can be on a different branch, enabling true parallel development without the need to stash or commit incomplete work.
Work on multiple features or branches simultaneously without context switching:
# Main working directory
/project (main branch)
# Additional worktrees
/project-worktrees/feature-a (feature/a branch)
/project-worktrees/feature-b (feature/b branch)
/project-worktrees/hotfix (hotfix/critical branch)
Common scenarios:
# Create worktree from existing branch
git worktree add ../project-feature-a feature/a
# Create worktree and new branch
git worktree add -b feature/new-feature ../project-new-feature
# Create worktree from specific commit
git worktree add ../project-hotfix abc123
# Use absolute or relative paths
git worktree add /path/to/worktrees/feature-x feature/x
# List all worktrees with their branches and paths
git worktree list
# Example output:
# /project abc123 [main]
# /project-feature-a def456 [feature/a]
# /project-feature-b ghi789 [feature/b]
# Remove worktree (must not have uncommitted changes)
git worktree remove ../project-feature-a
# Force remove (discards uncommitted changes)
git worktree remove --force ../project-feature-a
# Clean up stale worktree references
git worktree prune
# Simply cd to the worktree directory
cd ../project-feature-a
# All git commands work normally in each worktree
git status
git commit
git push
Option 1: Sibling directories
/projects/
├─ myproject/ (main)
├─ myproject-feature-a/
├─ myproject-feature-b/
└─ myproject-hotfix/
Option 2: Nested structure
/myproject/ (main)
└─ .worktrees/
├─ feature-a/
├─ feature-b/
└─ hotfix/
Option 3: Centralized worktrees
/worktrees/
├─ myproject-main/
├─ myproject-feature-a/
├─ myproject-feature-b/
└─ other-project-main/
# Project-branch pattern
git worktree add ../myproject-feature-auth feature/auth
# Purpose-based pattern
git worktree add ../myproject-review feature/pr-123
# Descriptive pattern
git worktree add ../myproject-hotfix-login-bug hotfix/login-bug
# You're working in main worktree on feature/large-feature
cd /project
# Urgent bug reported!
# Create hotfix worktree
git worktree add ../project-hotfix main
# Switch to hotfix worktree
cd ../project-hotfix
# Fix the bug
git checkout -b hotfix/critical-bug
# ... make changes ...
git commit -m "fix: critical production bug"
git push
# Return to feature work without losing context
cd /project
# You're working on your feature
cd /project
# Need to review a PR (branch: feature/team-pr)
git fetch origin feature/team-pr
git worktree add ../project-review feature/team-pr
# Review in separate worktree
cd ../project-review
# ... test, review, run code ...
# Clean up after review
cd /project
git worktree remove ../project-review
# Run long test suite in one worktree
cd /project-main
npm test # Takes 10 minutes
# Continue development in another worktree
cd /project-feature-x
# ... keep coding ...
.git/worktrees to track all worktrees in the main repository.git directory = shared configuration, hooks, and remotesgit worktree remove)# If you manually deleted a worktree directory
git worktree prune
# Force unlock a worktree
git worktree unlock <path>
# Move worktree to new location
git worktree move <worktree> <new-path>
# Example:
git worktree move ../project-feature-a ../new-location/feature-a
# See which branch each worktree is on
git worktree list
# Check worktree health
git worktree list --porcelain
This skill complements the git-project-management plugin commands:
/create_worktree - Automated worktree creation for parallel development/merge_worktree - Streamlined worktree merging and cleanupThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.