using-git-worktrees

Create isolated Git worktrees for feature development with automatic setup.

14|1|Updated Dec 29, 2011
One-click install
npx skills add https://github.com/doitian/dotfiles-public --skill using-git-worktrees-doitian
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/doitian/dotfiles-public/tree/main/ai/workflows/superpowers/skills/using-git-worktrees
Command: npx skills add https://github.com/doitian/dotfiles-public --skill using-git-worktrees-doitian

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill enables starting feature work in isolation by creating isolated git worktrees, ensuring the current workspace remains unaffected and changes can be tested independently.

Core Features & Use Cases

  • Directory selection: Reuses existing local worktrees from .worktrees or worktrees when available.
  • Preference handling: Honors CLAUDE.md specifications for directory choice when present.
  • Safety-first creation: Validates that the chosen location is ignored by git (project-local) or falls back to a global location, preventing accidental commits of worktree contents.
  • Automatic setup: After worktree creation, runs project setup steps (language/tool-specific) to bring the worktree to a ready state.

Quick Start

Ask me to set up an isolated git worktree for a feature branch.

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 git worktree for feature development?

To create an isolated git worktree, the skill sets up a feature branch in a separate directory, either reusing local .worktrees folders or defaulting to a global location, ensuring your current workspace remains unaffected. It then runs automatic project setup steps to bring the worktree to a ready state.

What is a git worktree and when do I need isolation for branching?

A git worktree links a branch to a separate directory, allowing you to isolate feature work and test changes independently without affecting your current repository. You need this when you want to safely manage multiple branches or test features simultaneously without stashing current changes.

How do I prevent accidentally committing git worktree contents?

To prevent accidental commits of worktree contents, the skill enforces safety checks using git check-ignore. It validates that local worktree directories are properly ignored by git, or falls back to a safe global location outside the repository.

Does git worktree creation honor project-specific directory preferences?

Yes, isolated git worktree creation honors project-specific directory preferences by checking CLAUDE.md specifications. It reuses existing local worktrees from .worktrees or worktrees directories when available, applying your chosen branching location for safe directory management.

Can I automate project setup steps after creating a git worktree?

Yes, you can automate project setup after creating a git worktree. The skill automatically runs language and tool-specific setup steps immediately after worktree creation, bringing the isolated development environment to a fully ready state for feature work.

What's the best way to manage git branches safely without disrupting the current workspace?

The best way to manage branches safely is using isolated git worktrees. This approach separates feature work into distinct directories, enforcing git check-ignore validations to protect your current workspace and ensure changes are tested independently without disruption.