
handbook-git-worktree
Git worktree skill that manages parallel branch checkouts without stashing changes.
- GitHub stars
- 143
What it does
- Adds a
git-worktreeskill for creating, listing, deleting, and switching between worktrees - Creates worktrees from local, remote, or new branches, placed in sibling directories named
../<project>-<branch> - Lists all active worktrees with navigation commands, so you can jump to the one you need
- Designed for working on multiple branches simultaneously without stashing your uncommitted changes
Git worktree management for working on multiple branches simultaneously
Add marketplace
/plugin marketplace add NikiforovAll/claude-code-rulesRun it inside Claude Code once, then install the plugin below.
Install
/plugin install handbook-git-worktree@cc-handbookRun it inside Claude Code after adding the marketplace.
Files
Discovered from sourceGit Worktree Management
Overview
This skill provides comprehensive Git worktree management capabilities, enabling work on multiple branches simultaneously in isolated directories. Worktrees eliminate the need for stashing when switching contexts and are ideal for parallel development, quick bug fixes, and code reviews.
When to Use This Skill
Use this skill when the user wants to:
- Create a new worktree from a local branch, remote branch, or new branch
- List all active worktrees with detailed information
- Delete and clean up worktrees
- Get navigation commands to switch between worktrees
- Set up parallel development environments
How It Works
Configuration
Location Strategy: Sibling directory pattern
- Worktrees are created outside the main repository:
../<project>-<branch> - Example: Main repo at
~/dev/myproject, worktree at~/dev/myproject-feature-x - Benefits: Clean separation, no nested repos, IDE-friendly
Naming Convention: <project>-<branch>
- Project name extracted using:
basename "$(git rev-parse --show-toplevel)" - Example:
myproject-feature-auth,myapp-bugfix-login
Interface
Hybrid Mode: Accepts arguments when provided, prompts when missing
Usage patterns:
# Interactive menu
User: "Manage my worktrees"
User: "Create a worktree"
# Direct with arguments
User: "Create worktree from remote branch feature-x"
User: "List all worktrees"
User: "Delete worktree for branch hotfix-123"
Core Operations
1. List Worktrees
Purpose: Show all active worktrees with detailed information
What to display:
- Index number for easy reference
- Worktree path
- Branch name
- HEAD commit hash (short)
- Commit message (first line)
- Indicator for current worktree
Implementation:
# Get project name
project=$(basename "$(git rev-parse --show-toplevel)")
# List worktrees with details
git worktree list -v
Output format:
Git Worktrees for myproject:
1. /Users/dev/myproject (main)
abc1234 Initial commit
[CURRENT]
2. /Users/dev/myproject-feature-x (feature-x)
def5678 Add authentication logic
3. /Users/dev/myproject-hotfix (hotfix-123)
789abcd Fix login bug
2. Create Worktree from Remote Branch
Purpose: Fetch and create a worktree from a remote branch
Steps:
- Validate we're in a git repository
- Get project name:
project=$(basename "$(git rev-parse --show-toplevel)") - Extract branch name from remote reference (e.g.,
origin/feature-x→feature-x) - Check if worktree already exists (warn and skip if it does)
- Fetch remote branch:
git fetch origin <branch-name> - Verify remote branch exists (check exit code)
- Determine worktree path:
../<project>-<branch-name> - Create worktree:
git worktree add ../<project>-<branch-name> origin/<branch-name> - Show success message with path and navigation command
Error handling:
- Not in git repo: Show clear error message
- Worktree already exists: "Worktree for branch 'X' already exists at Y. Use 'list' to see all worktrees."
- Remote branch doesn't exist: "Remote branch 'origin/X' not found. Available branches: [list]"
Success output:
✓ Created worktree for remote branch 'feature-x'
Location: /Users/dev/myproject-feature-x
Branch: feature-x (tracking origin/feature-x)
To switch to this worktree:
cd ../myproject-feature-x
To start working:
cd ../myproject-feature-x && code .
3. Create Worktree from Local Branch
Purpose: Create a worktree from an existing local branch
Steps:
- Validate we're in a git repository
- Get project name
- Verify local branch exists:
git rev-parse --verify <branch-name> - Check if worktree already exists
- Create worktree:
git worktree add ../<project>-<branch-name> <branch-name> - Show success message with navigation
Error handling:
- Local branch doesn't exist: "Local branch 'X' not found. Available branches: [list local branches]"
- Worktree already exists: Same as remote case
4. Create Worktree with New Branch
Purpose: Create a worktree with a brand new branch
Parameters needed:
- New branch name
- Base branch (optional, default: current branch)
Steps:
- Validate we're in a git repository
- Get project name
- Get base branch (use current if not specified)
- Check if worktree directory already exists
- Create worktree with new branch:
git worktree add -b <new-branch> ../<project>-<new-branch> <base-branch> - Show success message
Success output:
✓ Created new worktree with branch 'experiment-auth'
Location: /Users/dev/myproject-experiment-auth
Branch: experiment-auth (based on main)
To switch to this worktree:
cd ../myproject-experiment-auth
5. Delete Worktree
Purpose: Remove a worktree and show prune command
Steps:
- If no branch specified, list all worktrees for selection
- Verify worktree exists for specified branch
- Remove worktree:
git worktree remove <path>or manuallyrm -rf <path> - Show manual prune command (don't auto-execute per user preference)
Output:
✓ Removed worktree at /Users/dev/myproject-feature-x
To clean up metadata, run:
git worktree prune
6. Prune Worktrees
Purpose: Clean up worktree metadata
Steps:
- Run:
git worktree prune - Show what was cleaned
Output:
✓ Pruned stale worktree metadata
Run 'git worktree list' to see remaining worktrees.
7. Switch Helper
Purpose: Show easy navigation to worktrees
Implementation:
- List all worktrees (numbered)
- Provide copy-ready cd commands
Output:
Available worktrees:
1. main (current)
cd /Users/dev/myproject
2. feature-x
cd /Users/dev/myproject-feature-x
3. hotfix-123
cd /Users/dev/myproject-hotfix
Interactive Flow
When invoked without arguments:
-
Show menu:
Git Worktree Management 1. List all worktrees 2. Create from remote branch 3. Create from local branch 4. Create new branch 5. Delete worktree 6. Prune metadata 7. Switch between worktrees -
Prompt for selection
-
For create operations, prompt for required info (branch name, base branch, etc.)
-
Execute operation
-
Show results with clear next steps
Direct Command Parsing
When arguments are provided, parse intent:
- "list" → List operation
- "create remote " → Create from remote
- "create local " → Create from local
- "create new [from ]" → Create new branch
- "delete " → Delete worktree
- "prune" → Prune metadata
- "switch" → Switch helper
Error Handling Checklist
Before any operation:
- ✓ Verify in git repository:
git rev-parse --git-dir - ✓ Get project name successfully
- ✓ Validate branch exists (for remote/local operations)
- ✓ Check worktree doesn't already exist (for create operations)
- ✓ Provide actionable error messages with suggestions
Readme
Git Worktree
Git worktree management for working on multiple branches simultaneously.
Features
- Create worktrees from local, remote, or new branches
- List all active worktrees with navigation commands
- Delete and clean up worktrees
- Sibling directory pattern:
../<project>-<branch>
Installation
/plugin marketplace add nikiforovall/claude-code-rules
/plugin install handbook-git-worktree
Usage
The skill activates automatically when you mention worktree tasks:
"Manage my worktrees"
"Create worktree from remote branch feature-x"
"List all worktrees"
"Delete worktree for branch hotfix-123"
Example:
You: "Create a worktree for the feature-auth branch"
Claude: Creates ../myproject-feature-auth and provides cd command
Details
- Marketplace
- NikiforovAll/claude-code-rules
- Source
- plugins/handbook-git-worktree
- Category
- Productivity
- Listed since
- Apr 7, 2026
More from NikiforovAll/claude-code-rules
All 22- handbook-github-pr
- handbook-gitlab-mr
- handbook-glab
- handbook-microsoft-docs
- handbook-nano-banana
- handbook-qa
- handbook-reflect
- handbook-sounds
- handbook-structured-plan-mode
- handbook-team-stack
- handbook-visual-explainer
- dotnet-csharpier
- handbook
- handbook-agent-spec-kit
- handbook-code-review
- handbook-context7
- handbook-csharp-lsp
- handbook-discover
- handbook-dotnet
- handbook-elasticsearch
- handbook-extras
Similar to handbook-git-worktree
More Git & Releases
git-worktreesSkillneolabhq/context-engineering-kit1.2K installsGit worktree commands and workflow patterns for parallel development across multiple branches in separate directories.
create-worktreesPluginrohitg00/awesome-claude-code-toolkit2.8K starsGit worktree management for parallel development workflows
git-workflowsPluginmiles990/claude-software-skills26 starsGit version control, branching strategies, and collaboration patterns
handbook-glabPluginNikiforovAll/claude-code-rules143 starsGitLab CLI (glab) expertise for managing merge requests, issues, CI/CD pipelines, and repositories
workspacesPluginopenshift-eng/ai-helpers123 starsManage isolated git worktree workspaces for multi-repo development