using-git-worktrees

Creates isolated git worktree workspaces with baseline test verification before feature implementation.

3|1|Updated Jul 12, 2026
One-click install
npx skills add https://github.com/DuckKota/my-opencode-setup --skill using-git-worktrees-duckkota
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/DuckKota/my-opencode-setup/tree/main/src/skills/using-git-worktrees
Command: npx skills add https://github.com/DuckKota/my-opencode-setup --skill using-git-worktrees-duckkota

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 worktree tools when available or git worktree as a fallback. ## Core Features & Use Cases - Isolation Detection: Checks whether you are already inside a linked worktree or a submodule before creating anything, avoiding duplicate or phantom worktrees. - Native Tool Preference with Git Fallback: Uses platform-native worktree tools (e.g., EnterWorktree) first, falling back to git worktree add with directory selection, .gitignore verification, and sandbox permission handling. - Project Setup and Baseline Verification: Auto-detects Node.js, Rust, Python, or Go projects, installs dependencies, and runs the test suite to confirm a clean baseline before work begins. - Use Case: Before implementing a new feature branch, run this Skill to spin up an isolated worktree at .worktrees/feature-x, install dependencies, and confirm all tests pass. ## Quick Start Ask the AI to set up an isolated git worktree for your next feature branch 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 a new feature branch?▼

Run `git worktree add <path> -b <branch-name>` after choosing a directory such as `.worktrees/`. Verify the directory is gitignored first with `git check-ignore`, then install dependencies and run the test suite 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 rather than a submodule or normal checkout.

Should I use git worktree add or a native worktree tool?▼

Prefer a native worktree tool such as EnterWorktree or a /worktree command when one is available, since it manages placement, branching, and cleanup. Use manual `git worktree add` only as 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 the worktree directory is not in .gitignore?▼

An unignored worktree directory risks committing the entire worktree contents into the repository. Add the directory to .gitignore, commit that change, and only then create the worktree.