using-git-worktrees

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

3|1|Updated Apr 29, 2026
One-click install
npx skills add https://github.com/firstsun-dev/skills --skill using-git-worktrees-firstsun-dev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/firstsun-dev/skills/tree/main/plugins/software-delivery/skills/using-git-worktrees
Command: npx skills add https://github.com/firstsun-dev/skills --skill using-git-worktrees-firstsun-dev

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 piece of work happens 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: Uses platform-native worktree tools (e.g., EnterWorktree) when available, falling back to manual git worktree add only when necessary. - Safe Setup & Baseline Verification: Verifies the worktree directory is git-ignored, auto-detects project type (Node, Rust, Python, Go) to install dependencies, and runs tests to confirm a clean baseline. - Use Case: Before implementing a new feature, ask the agent to set up an isolated workspace; it creates .worktrees/my-feature, installs dependencies, runs the test suite, and reports readiness. ## Quick Start Ask the agent to set up an isolated worktree for your new feature branch and verify the project tests pass before starting implementation.

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 a new feature branch?▼

Run `git worktree add <path> -b <branch-name>` to create a linked worktree on a new branch. This Skill automates that flow, including directory selection, gitignore verification, dependency installation, and baseline tests.

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` to rule out being inside a submodule.

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

Prefer the platform's native worktree tool (such as EnterWorktree or a /worktree command) when available, since it manages placement, branching, and cleanup. Use manual `git worktree add` only as a fallback when no native tool exists.

Why must the worktrees directory be added to gitignore?▼

Project-local worktree directories like `.worktrees/` must be ignored so their contents are never tracked or committed to the repository. The Skill verifies this with `git check-ignore` and commits a gitignore update before creating the worktree.

What happens if git worktree creation fails due to sandbox permissions?▼

If `git worktree add` fails with a permission error, the Skill reports that the sandbox blocked creation and continues working in the current directory instead, running setup and baseline tests in place.