using-git-worktrees

Creates isolated git worktrees with baseline test verification before starting feature work.

Updated Aug 3, 2026
One-click install
npx skills add https://github.com/m-de-graaff/skills --skill using-git-worktrees-m-de-graaff
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/m-de-graaff/skills/tree/main/skills/using-git-worktrees
Command: npx skills add https://github.com/m-de-graaff/skills --skill using-git-worktrees-m-de-graaff

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Starting feature work directly in your current checkout risks disturbing uncommitted changes, long-running tasks, or the branch you are on. This Skill ensures work happens in an isolated git worktree, with a verified test baseline, so failures are never ambiguous between pre-existing breakage and new changes. ## Core Features & Use Cases - Isolation Detection: Detects whether you are already inside a linked worktree or submodule before creating anything, avoiding nested worktrees. - Native Tool Preference: Uses harness-native worktree tools (EnterWorktree, isolation flags) when available, falling back to git worktree add only when necessary. - Safe Setup: Verifies the worktree directory is git-ignored before creation, installs project dependencies, and runs the test suite to establish a baseline. - Use Case: Before executing a multi-step implementation plan, spin up .worktrees/feature-x on a new branch, run the existing test suite to confirm it is green, and only then start writing code. ## Quick Start Set up an isolated git worktree for this feature work and run the test suite to establish a baseline before making any changes.

Frequently Asked Questions about using-git-worktrees

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a git worktree for feature work?▼

Run `git worktree add .worktrees/<branch> -b <branch>` after confirming the directory is git-ignored with `git check-ignore`. If your harness provides a native worktree tool, use that instead so it can track and clean up the worktree.

How do I check if I am already inside a git worktree?▼

Compare `git rev-parse --git-dir` with `git rev-parse --git-common-dir`; if they differ, you are in a linked worktree. Also check `git rev-parse --show-superproject-working-tree`, since submodules produce the same signal but should be treated as normal checkouts.

Should I use git worktree add or a native worktree tool?▼

Prefer the native tool when one exists, such as EnterWorktree or an isolation flag on the Agent tool. Calling `git worktree add` directly creates state the harness cannot see, track, or clean up.

Why run the test suite before writing any code in a worktree?▼

A baseline test run distinguishes pre-existing failures from ones you introduce. Without it, the first failure you see later is ambiguous between 'I broke it' and 'it was already broken'.

What happens if git worktree add fails with a permission error?▼

A permission error means the sandbox blocked the operation. Report it, work in the current directory instead, and do not retry variations of the command.

When should I not use a git worktree?▼

Skip worktree creation when you are already inside a linked worktree, when the user explicitly declines isolation, or when parallel agents can use per-agent `isolation: "worktree"` instead of a manually managed worktree.