using-git-worktrees

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

2|Updated May 30, 2026
One-click install
npx skills add https://github.com/virahitvin8/crafty-gis --skill using-git-worktrees-virahitvin8
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/virahitvin8/crafty-gis/tree/main/GIT_STAR/assignment-generator/antigravity-skills-main/antigravity-skills-main/skills/using-git-worktrees
Command: npx skills add https://github.com/virahitvin8/crafty-gis --skill using-git-worktrees-virahitvin8

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: 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. - 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. - 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 implementing a new feature branch, ask the assistant to set up an isolated workspace; it will create .worktrees/feature-x, run npm install, and confirm all tests pass before coding begins. ## 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 git worktree for feature development?

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

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 a native platform tool such as EnterWorktree or a /worktree command when available, since it handles directory placement, branch creation, and cleanup automatically. Use manual git worktree add only as a fallback when no native tool exists.

Why should the worktree directory be added to gitignore?

A project-local worktree directory that is not ignored will have its contents tracked by git, polluting git status and risking accidental commits of the nested checkout. Verify with git check-ignore and commit the gitignore change before creating the worktree.

What happens if baseline tests fail in a new worktree?

Failing baseline tests indicate pre-existing issues rather than bugs from new work. Report the failures and ask whether to proceed or investigate before implementing, so new changes can be distinguished from existing breakage.