using-git-worktrees

Creates isolated git worktree workspaces with native tool detection and baseline test verification.

1|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/stefaniuk/loadout --skill using-git-worktrees-stefaniuk
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/stefaniuk/loadout/tree/main/.github/skills/using-git-worktrees
Command: npx skills add https://github.com/stefaniuk/loadout --skill using-git-worktrees-stefaniuk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Feature work done directly in a shared checkout risks polluting the current branch and mixing unrelated changes. This Skill guarantees an isolated workspace exists before implementation begins, detecting existing isolation, preferring native worktree tools, and falling back to manual git worktrees only when needed. ## Core Features & Use Cases - Isolation Detection: Checks git-dir versus git-common-dir and guards against submodule false positives before creating anything. - Tiered Workspace Creation: Prefers native harness worktree tools, then falls back to git worktree add with directory priority rules and .gitignore safety verification. - Baseline Verification: Auto-detects project type (Node.js, Rust, Python, Go), installs dependencies, and runs tests to confirm a clean starting state. - Use Case: Before implementing a new feature branch, run this Skill to spin up an ignored .worktrees/ directory, install dependencies, and confirm all tests pass so later failures are unambiguous. ## Quick Start Set up an isolated git worktree for my new feature branch and verify the project tests pass before I start implementing.

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 an isolated git worktree for feature work?▼

Run `git worktree add <path> -b <branch-name>` after choosing a directory such as `.worktrees/`. Verify the directory is git-ignored first with `git check-ignore`, then install dependencies and run the project tests to confirm a clean baseline.

How to 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 run `git rev-parse --show-superproject-working-tree` to rule out being inside a submodule, which shows the same difference.

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

Prefer a native tool such as EnterWorktree or a /worktree command when available, since it manages placement, branching, and cleanup. Manual `git worktree add` is only a fallback and can create phantom state the harness cannot track.

Why must the worktree directory be in .gitignore?▼

An unignored worktree directory risks committing the entire nested worktree contents into the parent repository. The Skill verifies ignore status with `git check-ignore` and commits a .gitignore update before creating the worktree.

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

A permission error usually means sandbox restrictions blocked worktree creation. The fallback is to inform the user, then run dependency setup and baseline tests directly in the current directory instead.

When should I not use git worktrees for isolation?▼

Skip worktree creation when you are already inside a linked worktree or when the user declines isolation and prefers working in place. Also avoid manual worktrees when a native harness tool is available to manage the workspace lifecycle.