worktree

Create or switch to a git worktree by name and persist active state.

Updated Apr 11, 2026
One-click install
npx skills add https://github.com/leessju/claude-skills --skill worktree-leessju
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree
Source: https://github.com/leessju/claude-skills/tree/main/worktree
Command: npx skills add https://github.com/leessju/claude-skills --skill worktree-leessju

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Git worktrees let you work on multiple branches in separate directories. This Skill simplifies creating a new worktree or switching to an existing one by name, and it persists the active state locally.

Core Features & Use Cases

  • Create a new worktree for a given name and branch and switch to it.
  • Move between existing worktrees by name with simple commands.
  • Persist active worktree path to ~/.claude/state/active-worktree for quick restoration.
  • Return to main by cleaning up state when requested.

Quick Start

Switch to or create a git worktree named NAME.

Frequently Asked Questions about worktree

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

FAQPage Schema
How do I switch between git worktrees without losing my working state?

You can switch git worktrees by name, which identifies the target and moves your working directory there. The active worktree path is persisted to a local state file for quick restoration during future sessions.

What is git worktree branch management used for?

Git worktree branch management is used for working on multiple features in isolated directories simultaneously. It prevents branch switching overhead by maintaining separate working trees for each branch, allowing safe transitions between independent development tasks.

How do I create a new git worktree for a specific branch?

To create a git worktree, provide a name and the target branch. The system sets up an isolated working directory linked to that branch and switches you to it, persisting the active state locally for future retrieval.

Can I persist my active git worktree path for later restoration?

Yes, the active git worktree path is persisted to a local state file at ~/.claude/state/active-worktree. This allows deterministic restoration of your working environment when you return to the project later.

Does git worktree automation work for multi-feature branch workflows?

Git worktree automation is specifically designed for workflows with multiple features or branches requiring isolated worktrees. It implements deterministic steps to ensure safe transitions and state persistence across complex development environments.

What is the best way to return to the main git branch from a worktree?

The best way to return to the main branch from a git worktree is by requesting a return to main, which cleans up the persisted active state. This safely transitions you back while maintaining the worktree structure for future use.