using-git-worktrees

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

Updated Jul 15, 2026
One-click install
npx skills add https://github.com/em411/supercodex --skill using-git-worktrees-em411
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/em411/supercodex/tree/main/skills/using-git-worktrees
Command: npx skills add https://github.com/em411/supercodex --skill using-git-worktrees-em411

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Feature work done directly in your main checkout risks polluting your current branch and mixing unrelated changes. This Skill ensures every implementation task starts in an isolated workspace, using your platform's native worktree tools when available and falling back to manual git worktrees otherwise. ## Core Features & Use Cases - Isolation Detection: Checks whether you are already inside a linked worktree (with a submodule guard) before creating anything, preventing nested worktrees. - Native Tool Preference: Defers to platform-native worktree tools (e.g., EnterWorktree) and only uses git worktree add as a fallback, avoiding phantom state the harness cannot manage. - Safe Directory Selection: Follows a priority order (explicit preference > existing .worktrees/ or worktrees/ > default .worktrees/) and verifies the directory is git-ignored before creation. - Baseline Verification: Auto-detects the project type (Node.js, Rust, Python, Go), installs dependencies, and runs tests to confirm a clean starting state. - Use Case: Before executing an implementation plan, ask the assistant to set up an isolated workspace; it detects your environment, creates the worktree safely, installs dependencies, and confirms tests pass. ## Quick Start Ask the assistant to set up an isolated worktree for your new feature branch and verify the project tests pass before starting work.

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 with a target path and new branch name, such as git worktree add .worktrees/my-feature -b my-feature. The Skill automates this after checking for existing isolation and preferring any native worktree tool your platform provides.

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

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

Prefer the native worktree tool (such as EnterWorktree or a /worktree command) whenever one is available, because it handles directory placement, branch creation, and cleanup. Use git worktree add only as a fallback when no native tool exists.

Why must the worktree directory be in .gitignore?

Project-local worktree directories like .worktrees/ must be ignored so their contents are never tracked or committed to the repository. Verify with git check-ignore before creating the worktree, and add the entry to .gitignore if it is missing.

What happens if baseline tests fail in a new worktree?

The Skill reports the failing tests and asks whether to proceed or investigate before any implementation begins. This prevents confusing pre-existing failures with bugs introduced by new work.