C✳CODEZ.WIN
🌐 English

Localized reading guide

using-git-worktreesPurpose, usage and source

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

Source retrieved:

Source repository
obra/superpowers
SKILL.md
skills/using-git-worktrees/SKILL.md
Repository stars
309,479
Repository updated
2026-10-30
Categories
Development
Last collected

License: MIT

Workflow excerpts are reading aids, not executable instructions from Codez. No third-party Skill was run to produce this page.

The purpose and workflow passages below are upstream material, organized and translated for reading. They are distinct from the separately labeled Codez editorial analysis.

What this Skill does

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 the upstream workflow works

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."

Upstream passage · L8 ↗

Step 0: Detect Existing Isolation

Before creating anything, check if you are already in an isolated workspace. 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: 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:

Upstream passage · L16 ↗

Step 1: Create Isolated Workspace

You have two mechanisms. Try them in this order.

Upstream passage · L47 ↗
Upstream passage · 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)

Requirements and setup

Step 2: Project Setup

Auto-detect and run appropriate setup:

Upstream passage · L102 ↗

Limits and quality checks

Safety Verification (project-local directories only)

MUST verify directory is ignored before creating worktree: If NOT ignored: Add to .gitignore, commit the change, then proceed.

Upstream passage · L78 ↗

Start with a safe trial

  1. Check the supported host and the repository installation instructions. Keep the Skill directory and its referenced scripts, assets and documentation together; SKILL.md alone may omit dependencies.
  2. Give the agent your real input, desired output and acceptance criteria. Invocation syntax and available tools depend on the host; this site does not assume a universal install command.
  3. Try the source workflow in a disposable project or on a copy. Review operations that change files, remote services or billable resources before allowing them.
  4. Validate the output against the source quality checks and your own requirements. A successful trigger or a high repository Star count does not establish a correct result.

Skill format and directory specification ↗

Read further in the source

Translation and scope

This reading guide selects passages from the pinned upstream SKILL.md. Translation is assisted. It is not a complete manual or a claim of tested compatibility. Read the original and its referenced files before use.

This introduction refers to the pinned version below; current repository activity and collection time are shown separately.

Source retrieved
Source commit
2ce8aa15d05bd57213e6f746f953aafb7ded7a8b
Source SHA-256
8cfb86f121269e8f7f12361e6795c4f6738828340e28964c9229d365666c9edd
Back to the full Skill catalog