using-git-worktrees

Creates isolated git worktree workspaces with detection, setup, and baseline test verification.

Updated Apr 4, 2026
One-click install
npx skills add https://github.com/SleyiW/iWana-neXt --skill using-git-worktrees-sleyiw
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/SleyiW/iWana-neXt/tree/main/.agents/skills/using-git-worktrees
Command: npx skills add https://github.com/SleyiW/iWana-neXt --skill using-git-worktrees-sleyiw

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 native platform worktree tools when available or falling back to manual git worktrees. ## 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 with Git Fallback: Uses platform-native worktree tools (e.g., EnterWorktree) first, and only runs git worktree add when no native tool exists. - 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, installs dependencies (npm, cargo, pip, go), runs the test suite to confirm a clean baseline, and reports readiness. ## Quick Start Ask the AI to set up an isolated worktree for your new feature 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 feature development?

Run `git worktree add <path> -b <branch-name>` from your repository root, then change into the new directory. This Skill automates the process by choosing a safe directory, verifying it is git-ignored, and creating the branch for you.

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

Git worktrees share the same repository object store, making them lighter and faster than full clones while keeping branches isolated. Use a separate clone only when you need a fully independent repository copy.

How do I avoid creating a worktree inside another worktree?

Compare `git rev-parse --git-dir` with `git rev-parse --git-common-dir`; if they differ, you are already in a linked worktree. Also check `git rev-parse --show-superproject-working-tree` to rule out being inside a submodule.

Why must the worktree directory be in .gitignore?

If a project-local worktree directory like `.worktrees/` is not ignored, its contents appear in git status and can be accidentally committed. The Skill runs `git check-ignore` and adds the directory to .gitignore before creating anything.

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

A permission error usually means the sandbox blocked directory creation outside the allowed scope. The Skill falls back to working in the current directory, then runs dependency setup and baseline tests in place.