using-git-worktrees

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

1|Updated May 3, 2021
One-click install
npx skills add https://github.com/leogurja/dotfiles --skill using-git-worktrees-leogurja
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/leogurja/dotfiles/tree/main/home/dot_agents/skills/using-git-worktrees
Command: npx skills add https://github.com/leogurja/dotfiles --skill using-git-worktrees-leogurja

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 manual git worktrees only when no native tool exists. ## Core Features & Use Cases - Isolation Detection: Runs git rev-parse checks to determine whether you are already in a linked worktree, a submodule, or a normal checkout before creating anything. - Native Tool Preference: Uses platform-native worktree tools (e.g. EnterWorktree, /worktree commands) when available, avoiding phantom state the harness cannot manage. - Safe Git Fallback: Creates worktrees in .worktrees/ or worktrees/ directories after verifying they are git-ignored, preventing accidental commits of worktree contents. - Use Case: Before implementing a new feature, the Skill sets up an isolated worktree, installs project dependencies (npm, cargo, pip, go), runs baseline tests, and reports a clean starting state. ## Quick Start Ask the assistant to set up an isolated worktree before starting work on a new feature branch.

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 first checks for native worktree tools and verifies the directory is git-ignored before creating anything.

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 the resolved paths 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 a native tool such as EnterWorktree or a /worktree command when one is available, since it manages directory placement, branching, and cleanup. Manual git worktree add is the fallback only when no native tool exists, because it creates 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 repository. The Skill runs git check-ignore on .worktrees or worktrees before creation and adds the entry to .gitignore with a commit if it is missing.

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

A permission error usually means the sandbox blocked worktree creation. The Skill reports the sandbox denial, then proceeds with dependency setup and baseline tests in the current directory instead of failing outright.

Why run baseline tests before starting implementation?▼

Baseline tests confirm the workspace starts clean, so later failures can be attributed to your changes rather than pre-existing breakage. If baseline tests fail, the Skill reports the failures and asks whether to proceed or investigate first.