using-git-worktrees

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

1|Updated Jun 24, 2026
One-click install
npx skills add https://github.com/maopujie10-sys/Bailongma --skill using-git-worktrees-maopujie10-sys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/maopujie10-sys/Bailongma/tree/main/src/skills/superpowers/using-git-worktrees
Command: npx skills add https://github.com/maopujie10-sys/Bailongma --skill using-git-worktrees-maopujie10-sys

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Starting feature work directly in your main checkout risks polluting your current branch, mixing unrelated changes, and losing track of experimental code. This Skill ensures every piece of feature work happens in an isolated workspace before implementation begins. ## 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 (like EnterWorktree) when available, falling back to manual git worktree add only when necessary. - Safe Directory Management: Selects worktree locations by priority (explicit preference > existing .worktrees/ > default) and verifies the directory is git-ignored before creation. - Baseline Verification: Auto-detects the project type (Node, Rust, Python, Go), installs dependencies, and runs tests to confirm a clean starting state. - Use Case: Before implementing a new feature branch, the Skill sets up .worktrees/feature-x, runs npm install and npm test, and reports a clean baseline so you can code with confidence. ## Quick Start Ask the AI to set up an isolated git 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 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 to check if I am already inside a git worktree?

Compare git rev-parse --git-dir with --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 like EnterWorktree when available, since it handles directory placement, branch creation, and cleanup automatically. Manual git worktree add is only a fallback when no native tool exists.

Why does git worktree add fail with a permission error?

Sandboxed environments can block worktree creation outside the allowed directory. When this happens, report the sandbox denial and continue working in the current directory after running setup and baseline tests in place.

What happens if baseline tests fail in a new worktree?

Failing baseline tests indicate pre-existing issues rather than problems with your new work. Report the failures and ask whether to proceed or investigate before writing any feature code.