using-git-worktrees

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

Updated Aug 3, 2026
One-click install
npx skills add https://github.com/Yvesdefaria/GymLab --skill using-git-worktrees-yvesdefaria
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/Yvesdefaria/GymLab/tree/main/.opencode/skills/using-git-worktrees
Command: npx skills add https://github.com/Yvesdefaria/GymLab --skill using-git-worktrees-yvesdefaria

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, preferring native worktree tools, and falling back to manual git worktrees only when needed. ## 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 workspaces. - Native Tool Preference with Git Fallback: Uses platform-native worktree tools (e.g., EnterWorktree) when available, otherwise creates a worktree under a verified, git-ignored .worktrees/ directory. - 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, the Skill confirms you are not already isolated, creates .worktrees/feature-x, runs npm install and npm test, and reports a ready workspace with passing tests. ## 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 workspace with git worktree?

Run git worktree add with a target path and a new branch name, such as git worktree add .worktrees/feature-x -b feature-x. 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 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 a native worktree tool or git worktree add?

Prefer a native tool such as EnterWorktree or a /worktree command when available, since it manages placement, branching, and cleanup. Use manual git worktree add only as a fallback when no native tool exists.

Why must the worktree directory be in .gitignore?

An unignored worktree directory causes the entire nested worktree contents to be committed into the parent repository. Run git check-ignore on .worktrees before creation, and add it to .gitignore with a commit if it is not ignored.

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

A permission error usually means the sandbox blocked worktree creation. The fallback is to inform the user, continue working in the current directory, and still run dependency setup and baseline tests in place.

When should I not create a new git worktree?

Skip creation when you are already inside a linked worktree, when the user declines isolation consent, or when a sandbox blocks creation. In those cases proceed in the existing workspace after running baseline tests.