using-git-worktrees

Create isolated Git worktrees for feature development with safety checks.

Updated Nov 4, 2022
One-click install
npx skills add https://github.com/CityBear3/dotfiles --skill using-git-worktrees-citybear3
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/CityBear3/dotfiles/tree/main/claude/skills/using-git-worktrees
Command: npx skills add https://github.com/CityBear3/dotfiles --skill using-git-worktrees-citybear3

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents disrupting your main workspace by creating isolated Git worktrees for feature work while enforcing safety checks that avoid accidentally tracking worktree directories.

Core Features & Use Cases

  • Isolated feature work: Creates a separate branch-backed worktree so you can develop multiple changes without repeated branch switching.
  • Smart worktree directory selection: Prefers existing .worktrees/worktrees directories, then checks CLAUDE.md for a configured preference, and otherwise asks the engineer where to create worktrees.
  • Safety verification with git check-ignore: Ensures project-local worktree directories are ignored before creation to reduce the risk of committing worktree artifacts.
  • Bootstrapped setup and baseline verification: Runs project-appropriate dependency installation and executes a clean test baseline before reporting readiness.

Quick Start

Use the using-git-worktrees skill to set up an isolated workspace for implementing a new feature while ensuring the chosen worktree directory is safe and tests pass.

Frequently Asked Questions about using-git-worktrees

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I isolate feature development from my main git workspace without switching branches?

Git worktrees create isolated branch-backed directories so you can develop multiple features in parallel without repeatedly switching branches in your main workspace. This prevents disrupting your current working state while keeping changes safely separated.

How does git check-ignore prevent accidentally committing worktree artifacts?

Git check-ignore validates that project-local worktree directories are ignored before creation, enforcing safety verification to reduce the risk of committing worktree artifacts. This ensures your isolated feature directories remain untracked by the repository.

What's the best way to set up an isolated git worktree for a new feature?

Setting up an isolated git worktree involves smart directory selection that prefers existing .worktrees or worktrees folders, then checks CLAUDE.md for configured preferences, and otherwise prompts you for a location. Project setup and a clean baseline test pass are then executed automatically.

Do I need to configure a specific directory for git worktrees before creating one?

No manual configuration is required. Worktree directory selection prioritizes existing .worktrees directories first, then checks CLAUDE.md for a configured preference, and otherwise asks you directly where to create the worktree, ensuring flexible setup.

Why run dependency installation and baseline tests before starting feature work in a worktree?

Running dependency installation and a clean baseline test pass in the new worktree verifies that the isolated environment is fully bootstrapped and ready. This confirms your feature work starts from a known-good state before implementation begins.

Can I use git worktrees to prepare a workspace for agent-driven development steps?

Yes, git worktrees are designed for preparing an agent-driven workspace for subsequent implementation steps. By creating an isolated worktree with validated ignore status and passing baseline tests, the environment is safe and ready for automated feature work.