using-git-worktrees

Create isolated git worktrees for parallel development across branches.

35|5|Updated Jul 5, 2025
One-click install
npx skills add https://github.com/alexei-led/claude-code-config --skill using-git-worktrees-alexei-led
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/alexei-led/claude-code-config/tree/main/skills/using-git-worktrees
Command: npx skills add https://github.com/alexei-led/claude-code-config --skill using-git-worktrees-alexei-led

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill creates clean, isolated Git workspaces for each feature or bugfix, eliminating context-switching and preventing accidental commits to the wrong branch, so you can focus on one task at a time.

Core Features & Use Cases

  • Parallel Development Sandboxes: Spin up independent directories linked to different branches, all from the same repository.
  • Automated Project Setup: New worktrees automatically run the appropriate setup command (e.g., npm install, go mod download).
  • Use Case: Imagine you need to urgently fix a production bug while in the middle of a feature. Use this Skill to instantly create a separate worktree for the hotfix, test it in isolation, and merge it, without touching your feature branch.

Quick Start

Use the using-git-worktrees skill to create a new isolated workspace for a branch named 'feature/user-auth' starting from the 'main' 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 work on multiple Git branches simultaneously without switching back and forth?

Git worktrees create isolated directories linked to different branches, letting you develop on several branches in parallel from the same repository. Each worktree is a separate checkout, eliminating context-switching and preventing accidental commits to the wrong branch.

Can I automate project setup when creating a new Git worktree?

Yes. When you create a worktree, the Skill automatically runs the appropriate setup command for your ecosystem—such as npm install or go mod download—so your new workspace is ready to develop in immediately.

What's the best way to handle urgent hotfixes while working on a feature branch?

Create a separate Git worktree for the hotfix branch. This lets you fix and test the production bug in isolation without interrupting your feature work, then merge the fix independently.

How do I organize multiple Git worktrees in my project?

The Skill discovers and uses project-local '.worktrees' or 'worktrees' directories, and respects preference hints from CLAUDE.md. If no directory exists, you're prompted to specify where worktrees should be stored.

Does Git worktree creation verify my .gitignore configuration?

Yes. The Skill checks and updates .gitignore to ensure worktrees are properly excluded from version control, preventing accidental commits of worktree metadata.

How do I know when a new Git worktree is ready to use?

After creation, the Skill reports the final worktree path and test status, confirming the isolated workspace is initialized and ready for development.