using-git-worktrees

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

1|Updated Aug 31, 2026
One-click install
npx skills add https://github.com/nguyenhungtran18/skill-and-tool-tracker --skill using-git-worktrees-nguyenhungtran18
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/nguyenhungtran18/skill-and-tool-tracker/tree/main/skills/using-git-worktrees
Command: npx skills add https://github.com/nguyenhungtran18/skill-and-tool-tracker --skill using-git-worktrees-nguyenhungtran18

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, 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 or a git submodule before creating anything, avoiding duplicate or phantom worktree state. - Native Tool Preference with Git Fallback: Uses harness-provided worktree tools (e.g., EnterWorktree) first, and only runs git worktree add when no native tool exists, with directory selection priority and .gitignore safety verification. - Project Setup and Baseline Verification: Auto-detects Node.js, Rust, Python, or Go projects to install dependencies, then runs the test suite to confirm a clean baseline before implementation. - Use Case: Before implementing a new feature branch, the Skill detects you are in a normal repo, creates .worktrees/feature-x after verifying it is git-ignored, runs npm install and npm test, and reports a ready workspace with passing tests. ## 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 workspace with git worktrees?▼

Run git worktree add with a target path and new branch name, such as placing it under a .worktrees directory at the project root. Verify the directory is git-ignored first, then install dependencies and run baseline tests before starting work.

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 git worktree add or a native worktree tool?▼

Prefer a native tool like EnterWorktree or a /worktree command when one is available, since it manages placement, branching, and cleanup automatically. 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 worktree contents into the repository. Run git check-ignore on .worktrees or worktrees before creation, and add it to .gitignore with a commit if it is not already ignored.

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

A permission error usually means the sandbox blocked worktree creation. In that case, inform the user, continue working in the current directory, and still run dependency setup and baseline tests in place.

Why run baseline tests before implementing a feature?▼

Baseline tests confirm the workspace starts clean, so any later test failure is unambiguously caused by your changes. If baseline tests fail, report the failures and ask whether to proceed or investigate first.