using-git-worktrees

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

Updated Jul 23, 2025
One-click install
npx skills add https://github.com/derrik-fleming/dotfiles --skill using-git-worktrees-derrik-fleming
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/derrik-fleming/dotfiles/tree/main/private_dot_agents/skills/using-git-worktrees
Command: npx skills add https://github.com/derrik-fleming/dotfiles --skill using-git-worktrees-derrik-fleming

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Starting feature work directly in your main checkout risks polluting your current branch and mixing unrelated changes. This Skill ensures every implementation task begins in an isolated workspace, detecting existing isolation first and falling back to git worktrees only when no native tool exists. ## Core Features & Use Cases - Isolation Detection: Checks whether you are already inside a linked worktree or a submodule 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 for worktree placement (existing .worktrees/, legacy global path, declared preference, default) and verifies the directory is git-ignored before creation. - Use Case: Before implementing a new feature, the Skill sets up .worktrees/feature-x, runs npm install or the appropriate project setup, executes the test suite to confirm a clean baseline, and reports the workspace is ready. ## Quick Start Ask the assistant to set up an isolated worktree for your next feature using the using-git-worktrees skill before writing any code.

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>` from your repository root, then change into the new directory. The Skill automates this by choosing a directory, verifying it is git-ignored, and creating the branch in one flow.

Should I use git worktree or a separate clone for parallel development?▼

Git worktrees share the same repository object store, so they are lighter and faster than separate clones while still giving each branch its own working directory. Use a clone only when you need fully independent repository state.

How do I know 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` to rule out being inside a submodule, which shows the same difference.

Why should the worktrees directory be added to gitignore?▼

A project-local worktree directory that is not ignored will appear in git status and its contents can be accidentally committed to the repository. The Skill runs `git check-ignore` first and adds the directory to .gitignore before creating anything.

What happens if tests fail in a new worktree baseline?▼

The Skill runs the project's test suite after setup to confirm a clean baseline. If tests fail, it reports the failures and asks whether to proceed or investigate, so pre-existing breakage is not confused with new bugs.