git-worktreeslisted
Install: claude install-skill bitranox/bitranox-skills
# Git Worktrees
> Adapted from the superpowers plugin (MIT).
## 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 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 note:** a plain submodule does NOT trip this test - measured with these exact commands,
`GIT_DIR` and `GIT_COMMON` both resolve to `<super>/.git/modules/<name>`, so they compare equal and
the submodule reads as a normal checkout, which is how you want to treat it. The pair differs only
in a linked worktree. Run this if you want it stated explicitly, or when a submodule may itself
have a worktree attached:
```bash
# Returns a path when you are inside a submodule; empty otherwise
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 br