Agent skill

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

usewhale929★ · +12/wk · 1 repos on radarProfile →
claude-codeMIT
Install
npx skills add usewhale/Whale --skill using-git-worktrees --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 8 KB
Bundled scripts: none
Path: .agents/skills/using-git-worktrees/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 974 · +45 this week
Language: Go
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

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 3 (Project Setup). Do NOT create another worktree.

What's inside
Steps it walks through
  1. Overview
  2. Step 0: Detect Existing Isolation
  3. Step 1: Create Isolated Workspace
  4. 1a. Native Worktree Tools (preferred)
  5. 1b. Git Worktree Fallback
  6. Step 3: Project Setup
  7. Step 4: Verify Clean Baseline
  8. Report
  9. Quick Reference
  10. Common Mistakes
  11. Fighting the harness
  12. Skipping detection
  13. Skipping ignore verification
  14. Assuming directory location
Commands it runs
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
ls -d .worktrees 2>/dev/null     # Preferred (hidden)
ls -d worktrees 2>/dev/null      # Alternative
ls -d ~/.config/superpowers/worktrees/$project 2>/dev/null
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
Determine path based on chosen location
For project-local: path="$LOCATION/$BRANCH_NAME"
For global: path="~/.config/superpowers/worktrees/$project/$BRANCH_NAME"
git worktree add "$path" -b "$BRANCH_NAME"
More from Whale
All skills →
About this skill
What does the using-git-worktrees skill do?

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

How do I install it?

Run `npx skills add usewhale/Whale --skill using-git-worktrees --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From usewhale/Whale, a repository with 974 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going