Git Worktrees
Manage git worktrees for working on multiple branches simultaneously.
Install
npx skills add obra/superpowers --skill using-git-worktreesgit clone --depth 1 https://github.com/obra/superpowers.git /tmp/superpowers
mkdir -p ~/.claude/skills
cp -r /tmp/superpowers/skills/using-git-worktrees ~/.claude/skills/using-git-worktreesPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
What this skill does
Creates isolated git worktrees with safety checks. Manage multiple working directories for the same repository.
Trigger phrases
Claude loads this skill automatically when you say things like:
How it works
- Create isolated worktrees
- Manage branch switching
- Clean up completed work
When to use it
- When working on multiple features
- For parallel development
- When reviewing PRs
From the SKILL.md
# Using Git Worktrees ## Overview Ensure work happens in an isolated workspace. Prefer your platform's native worktree tools. Fall back to manual git worktrees only when no native tool is available. **Core principle:** Detect existing isolation first. Then use native tools. Then fall back to git. Never fight the harness. **Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace." ## Step 0: Detect Existing Isolation **Before creating anything, check if you are already in an isolated workspace.** ```bash GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P) GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P) BRANCH=$(git branch --show-current) ``` **Submodule guard:** `GIT_DIR != GIT_COMMON` is also true inside git submodules. Before concluding "already in a worktree," verify you are not in a submodule: ```bash # If this returns a path, you're in a submodule, not a worktree — treat as normal repo git rev-parse --show-superproject-working-tree 2>/dev/null ``` **If `GIT_DIR != GIT_COMMON` (and not a submodule):** You are already in a linked worktree. Skip to Step 2 (Project Setup). Do NOT create another worktree. Report with branch state: - On a branch: "Already in isolated workspace at `<path>` on branch `<name>`." - Detached HEAD: "Already in isolated workspace at `<path>` (detached HEAD, externally managed). Branch creation needed at finish time."
Details
- Skill name
using-git-worktrees- Repository
- obra/superpowers
- Path
skills/using-git-worktrees/SKILL.md
FAQ
What does the Git Worktrees skill do?
Creates isolated git worktrees with safety checks. Manage multiple working directories for the same repository.
How do I install the Git Worktrees skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add obra/superpowers --skill using-git-worktrees. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Related skills
Brainstorming
obra/superpowers
Transforms rough ideas into fully-formed designs. Structure your brainstorming sessions and develop ideas systematically.
Dispatching Parallel Agents
obra/superpowers
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
Executing Plans
obra/superpowers
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
Receiving Code Review
obra/superpowers
Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation
Finishing a Development Branch
obra/superpowers
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work
Requesting Code Review
obra/superpowers
Use when completing tasks, implementing major features, or before merging to verify work meets requirements
Browse the most popular Claude skills, all git & code review skills, or write your own with the skills generator.