using-git-worktrees

Creates isolated git worktrees or subagent workspaces before starting feature implementation work.

Updated Jun 20, 2026
One-click install
npx skills add https://github.com/dchavez3395/Puchica-hydrogen --skill using-git-worktrees-dchavez3395
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/dchavez3395/Puchica-hydrogen/tree/main/docs/superpowers/skills/openclaw-ports/using-git-worktrees
Command: npx skills add https://github.com/dchavez3395/Puchica-hydrogen --skill using-git-worktrees-dchavez3395

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 edits. This Skill ensures every implementation task begins in a verified isolated workspace, with a clean test baseline, before any code changes happen. ## Core Features & Use Cases - Isolation Detection: Checks whether you are already inside a linked git worktree (with a submodule guard) before creating anything, preventing nested worktrees. - Native-Tool-First Strategy: Prefers platform-native isolation such as a clean subagent context (e.g. sessions_spawn) and falls back to git worktree add only when filesystem-level isolation is required. - Safe Worktree Creation: Selects the worktree directory by priority (explicit preference > existing .worktrees/ or worktrees/ > default), verifies it is git-ignored, and handles sandbox permission errors gracefully. - Baseline Verification: Auto-detects the project type (Node, Rust, Python, Go), installs dependencies, and runs the test suite to confirm a clean starting point. - Use Case: Before implementing a new checkout feature, run this Skill to spin up an isolated workspace on a fresh branch, install dependencies, and confirm all existing tests pass. ## Quick Start Set up an isolated workspace for my new feature branch and verify the test baseline is clean 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 work?▼

Run `git worktree add <path> -b <branch-name>` after choosing a directory such as `.worktrees/`. Verify the directory is git-ignored first with `git check-ignore`, 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 and `git rev-parse --show-superproject-working-tree` returns nothing, you are in a linked worktree, not a submodule, and should not create another one.

Should I use git worktree or a subagent for task isolation?▼

Prefer a native subagent context such as sessions_spawn when available, since it provides process-level isolation without touching the filesystem. Use `git worktree add` only when you need parallel branches coexisting on disk.

Does git worktree add work on Windows?▼

Yes, `git worktree add` works on Windows under PowerShell and Git Bash. Use absolute Windows paths, and note that branch names with forward slashes like `feature/x` create nested directories such as `.worktrees/feature/x`.

Why must the worktree directory be git-ignored before creation?▼

If the project-local worktree directory is not ignored, its contents can be accidentally tracked and committed, polluting git status. Verify with `git check-ignore` and add the directory to .gitignore before creating the worktree.

What should I do if baseline tests fail in a new worktree?▼

Report the failures and ask whether to proceed or investigate before writing any code. Proceeding with failing tests makes it impossible to distinguish new bugs from pre-existing issues.