using-git-worktrees

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "using-git-worktrees" with this command: npx skills add hjewkes/agent-skills/hjewkes-agent-skills-using-git-worktrees

Using Git Worktrees

Overview

Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.

Core principle: Systematic directory selection + safety verification = reliable isolation.

Announce at start: "I'm using the using-git-worktrees skill to set up an isolated workspace."

Worktree Creation

Use scripts/worktree-setup <branch-name> to handle directory selection, safety verification, dependency installation, and baseline testing in one step.

The script auto-detects the worktree directory (.worktrees/ > worktrees/ > CLAUDE.md preference), verifies gitignore, installs deps, and runs baseline tests. If no directory is auto-detected, it exits with a suggestion — the skill then asks the user and re-runs with --dir <path>.

Options: --dir <path> (override directory), --no-install, --no-test Exit codes: 0 = ready + tests pass, 1 = fatal, 2 = created but tests fail/not found

Quick Reference

SituationAction
.worktrees/ existsUse it (verify ignored)
worktrees/ existsUse it (verify ignored)
Both existUse .worktrees/
Neither existsCheck CLAUDE.md -> Ask user
Directory not ignoredAdd to .gitignore + commit
Tests fail during baselineReport failures + ask

Red Flags

Never: Create worktree without verifying ignored (project-local), skip baseline test verification, proceed with failing tests without asking, assume directory location.

Always: Follow directory priority (existing > CLAUDE.md > ask), verify ignored, auto-detect and run project setup, verify clean test baseline.

Integration

Called by: brainstorming (Phase 4), plan-execution Pairs with: finishing-a-development-branch (cleanup after work complete)

For detailed creation steps, setup commands, and example workflow, see references/creation-steps.md.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

using-git-worktrees

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

self-improve

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

agent-browser

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

skills-management

No summary provided by upstream source.

Repository SourceNeeds Review