Use when working on multiple branches simultaneously, context switching without stashing, reviewing PRs while developing, testing in isolation, or comparing implementations across branches - provides git worktree commands and workflow patterns for parallel development with multiple working directories.
View on GitHubFebruary 2, 2026
Select agents to install to:
npx add-skill https://github.com/NeoLabHQ/context-engineering-kit/blob/main/plugins/git/skills/worktrees/SKILL.md -a claude-code --skill worktreesInstallation paths:
.claude/skills/worktrees/# Git Worktrees ## Overview Git worktrees enable checking out multiple branches simultaneously in separate directories, all sharing the same repository. Create a worktree instead of stashing changes or cloning separately. **Core principle:** One worktree per active branch. Switch contexts by changing directories, not branches. ## Core Concepts | Concept | Description | |---------|-------------| | **Main worktree** | Original working directory from `git clone` or `git init` | | **Linked worktree** | Additional directories created with `git worktree add` | | **Shared `.git`** | All worktrees share same Git object database (no duplication) | | **Branch lock** | Each branch can only be checked out in ONE worktree at a time | | **Worktree metadata** | Administrative files in `.git/worktrees/` tracking linked worktrees | ## Quick Reference | Task | Command | |------|---------| | Create worktree (existing branch) | `git worktree add <path> <branch>` | | Create worktree (new branch) | `git worktree add -b <branch> <path>` | | Create worktree (new branch from ref) | `git worktree add -b <branch> <path> <start>` | | Create detached worktree | `git worktree add --detach <path> <commit>` | | List all worktrees | `git worktree list` | | Remove worktree | `git worktree remove <path>` | | Force remove worktree | `git worktree remove --force <path>` | | Move worktree | `git worktree move <old> <new>` | | Lock worktree | `git worktree lock <path>` | | Unlock worktree | `git worktree unlock <path>` | | Prune stale worktrees | `git worktree prune` | | Repair worktree links | `git worktree repair` | | Compare files between worktrees | `diff ../worktree-a/file ../worktree-b/file` | | Get one file from another branch | `git checkout <branch> -- <path>` | | Get partial file changes | `git checkout -p <branch> -- <path>` | | Cherry-pick a commit | `git cherry-pick <commit>` | | Cherry-pick without committing | `git cherry-pick --no-commit <commit>` | | Merge without auto-commit | `g