From yellow-core
Git worktree management for isolated parallel development. Use when reviewing PRs in isolation, working on multiple features simultaneously, or when workflows offer worktree option.
How this skill is triggered — by the user, by Claude, or both
Slash command
/yellow-core:git-worktreeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Manage git worktrees for isolated parallel development with a simple, safe
Manage git worktrees for isolated parallel development with a simple, safe interface.
Creates and manages git worktrees — separate working directories from the same repository that allow you to:
ALWAYS use the manager script. NEVER use raw git worktree add directly.
The manager script provides:
${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh
Replace ${CLAUDE_PLUGIN_ROOT} with the actual plugin installation path.
Create a new worktree:
worktree-manager.sh create <branch-name> [from-branch]
Behavior:
.worktrees/<branch-name>/main by default (or specify from-branch).env* files from main repo.worktrees/ to .gitignore if missingExamples:
# Create worktree for feature branch
worktree-manager.sh create feature-auth
# Create worktree from specific branch
worktree-manager.sh create hotfix-security develop
List all worktrees:
worktree-manager.sh list
worktree-manager.sh ls
Output:
Worktrees:
main /home/user/repo (clean)
feature-auth /home/user/repo/.worktrees/feature-auth (modified)
pr-review-123 /home/user/repo/.worktrees/pr-review-123 (clean)
Switch to a worktree directory:
worktree-manager.sh switch <name>
worktree-manager.sh go <name>
Note: Prints cd command for shell evaluation:
# Use with eval or source
eval "$(worktree-manager.sh switch feature-auth)"
# Or create shell function
wtgo() { eval "$(worktree-manager.sh go "$1")"; }
Copy .env files to a worktree:
worktree-manager.sh copy-env <name>
Copies all .env* files from main repo to specified worktree. Useful if you've
updated environment configuration and need to sync.
Remove inactive worktrees:
worktree-manager.sh cleanup
worktree-manager.sh clean
Behavior:
.worktrees/ directory if all cleaned upWhen reviewing a PR and you're not on the target branch:
# Workflow offers worktree option
/workflows:review
# Choose worktree option
# Skill automatically creates worktree for PR branch
# You can review without affecting your current work
When working on multiple features:
# Start feature 1
/workflows:work
# Creates worktree for feature-1
# In another terminal, start feature 2
cd .worktrees/feature-2
/workflows:work
# Both features developed independently
When you need direct control:
# Create worktree
worktree-manager.sh create experimental-refactor
# Switch to it
eval "$(worktree-manager.sh go experimental-refactor)"
# List all
worktree-manager.sh list
# Clean up when done
worktree-manager.sh cleanup
# You're on feature-auth branch, working on authentication
$ git branch --show-current
feature-auth
# PR needs review on different branch
$ /workflows:review pr-123
# Workflow detects branch mismatch, offers worktree option
# Select "Create worktree for isolated review"
# Worktree created automatically:
# - Branch: pr-review-123
# - Location: .worktrees/pr-review-123/
# - .env files copied
# - Ready for isolated review
# After review, cleanup:
$ worktree-manager.sh cleanup
# Main repo: working on feature A
$ pwd
/home/user/myproject
# Need to quickly prototype feature B
$ worktree-manager.sh create feature-b
Created worktree: .worktrees/feature-b
$ eval "$(worktree-manager.sh go feature-b)"
$ pwd
/home/user/myproject/.worktrees/feature-b
# Work on feature B
$ nvim src/feature-b.ts
$ git commit -m "feat: prototype feature B"
# Switch back to main repo
$ cd /home/user/myproject
# Both features isolated, no stashing needed
When /workflows:review detects you're not on the target branch:
/git-worktree create pr-review-<number>When starting feature work:
/git-worktree create <branch-name>See troubleshooting.md for common issues and solutions.
.worktrees/ directorymain (unless specified)Git worktree documentation:
man git-worktree
Common git worktree commands:
git worktree list # List worktrees
git worktree remove <path> # Remove specific worktree
git worktree prune # Clean up stale references
But use the manager script instead for consistent, safe operations.
npx claudepluginhub kinginyellows/yellow-plugins --plugin yellow-coreManage Git worktrees for isolated parallel development. Automates creation, switching, and cleanup with .env copying and .gitignore management. Useful for code reviews and feature work.
Manages Git worktrees for parallel development: create from main with .env copying, list status, switch, cleanup interactively via bash script.
Manages git worktrees via unified bash script for parallel development: creates isolated feature environments, lists/switches status, copies .env files, cleans up merged/stale worktrees.