git-worktree

Installation
SKILL.md

Git worktree manager

GATE: If the task runs inside an existing worktree (a worktree path is given and no create/remove/switch is requested), none of the creation flow applies: work in place and skip this skill. To check: git rev-parse --show-toplevel appears as a linked entry in git worktree list.

Working rules

  • Preserve other sessions' branches, files, and staged work (see Ownership).
  • Verify dependencies resolve first-party code from the intended worktree.
  • Keep merge, push, and cleanup within user authorization; report the exact exercised checkout and resulting commit.

Always use the manager script

Never call git worktree add directly; always use the worktree-manager.sh script.

The manager handles setup:

  1. Copies .env, .env.local, .env.test, etc. from the main checkout, only when the base is the default branch or a local branch that already contains the fetched commit (a branch that exists only on origin gets none); it never overwrites or follows an existing file or symlink in the new tree
  2. Ensures .worktrees is in the main checkout's .gitignore
  3. Creates consistent directory structure
  4. After creation, install dependencies if detected: package.json → npm install, composer.json → composer install, pyproject.toml → pip install -e ., go.mod → go mod download
Installs
156
GitHub Stars
45
First Seen
Apr 13, 2026