← ClaudeAtlas

git-worktreeslisted

Use when starting feature work that needs an isolated workspace or worktree separate from the current branch, or before executing an implementation plan that should not disturb the current checkout, or when finishing with a worktree - deleting one leaves its per-topic build cache behind outside the checkout, so the disk stays full and nothing lists what to reclaim
bitranox/bitranox-skills · ★ 1 · AI & Automation · score 57
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