Sign in
Explore
Skills · SkillEveryday codingGit & pull requestsReviewed

using-git-worktrees

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback

Kind
Skill
Works with
Claude Code, Codex, Cursor, Gemini / Antigravity
Source
obra/superpowers @ 8ca22dba9a94
Path
skills/using-git-worktrees/SKILL.md
Jobs
Git workflow
Topics
Git & pull requests

Credit

Made by
obra
Original
github.com/obra/superpowers/blob/8ca22dba9a94f28898bbce59f253…
License
MIT

Listed by Skill Manifest; not made by us.

InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
Install factsScanned 3 Nov 2026
Adds
  • .claude/skills/using-git-worktrees/ (the skill folder)
Runs scripts
Yes
  • shell block in the text
Uses the network
Yes
  • downloads npm packages
  • downloads Python packages
Needs secrets
None found
Reads environment variables
  • LOCATION
  • BRANCH_NAME
Calls other skills
  • /worktree
Source revision
8ca22dba9a94
Licence
MIT
Last activity
26 Nov 2026
Source changed after the scan
Yes
  • Last push 26 Nov 2026, scanned 3 Nov 2026; read it again before you rely on this scan
Review
Reviewed

Found by a static scan of the stored text; nothing is run. “None found” is not a guarantee, so read what you install before you run it.

# 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
```
…