using-git-worktrees · git:20260328.4349b30 · 2026-03-28 · sha256 214bc23096d08080
using-git-worktrees git:20260328.4349b30A
Immutable. This exact content is served forever at /api/v1/blob/214bc23096d08080.
--- name: using-git-worktrees description: > Use before implementation when work should be isolated from the current branch. Triggers on: "use a worktree", "isolate this work", "don't touch main", experimental or risky changes that need isolation. --- # Using Git Worktrees Create an isolated branch workspace with safe defaults. ## Required Start Announce: `I'm using the using-git-worktrees skill to set up an isolated workspace.` ## Directory Selection Priority 1. Existing `.worktrees/` 2. Existing `worktrees/` 3. Project guidance file (for example `CLAUDE.md`) 4. Ask user ## Safety Check For project-local worktree directories, verify ignore rules before creating: ```bash git check-ignore -q .worktrees || git check-ignore -q worktrees ``` If not ignored, add ignore entry before proceeding. ## Creation Steps 1. Detect project root and feature branch name. 2. Create worktree and branch: ```bash git worktree add <path> -b <branch> cd <path> ``` 3. Run project setup using the full worktree path — the `cd` in step 2 does not persist across separate shell calls. Use absolute paths or `cd <path> && <command>` in every subsequent Bash call rather than assuming the working directory carried over. 4. Run baseline tests. ## Failure Handling If baseline tests fail, report failures and ask whether to continue. ## Success Output Report: - Worktree path - Branch name - Setup command(s) run - Baseline test status ## Integration Use with: - `writing-plans` - `subagent-driven-development` - `executing-plans` Cleanup is handled by `finishing-a-development-branch`.