git-worktree

Create, list, switch, and clean up isolated Git worktrees.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/mengblom/dex-ghx --skill git-worktree-mengblom
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-worktree
Source: https://github.com/mengblom/dex-ghx/tree/main/.claude/plugins/compound-engineering/skills/git-worktree
Command: npx skills add https://github.com/mengblom/dex-ghx --skill git-worktree-mengblom

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This skill eliminates the friction and risk of managing multiple parallel Git contexts by creating, switching, and cleaning up isolated worktrees with consistent setup.

Core Features & Use Cases

  • Create isolated worktrees from main with consistent directory naming and structure for parallel development or PR review.
  • List and switch between worktrees with clear “current” status so you can move fast without losing context.
  • Clean up inactive worktrees interactively with confirmation to prevent accidental deletions.
  • Automatically manage environment parity by copying .env* files (excluding .env.example) into new worktrees.
  • Safety guardrails that enforce using the manager script rather than raw git worktree add.

Quick Start

Ask to create a fresh isolated worktree for feature development: “Create a worktree named feature-login from main.”

Frequently Asked Questions about git-worktree

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

FAQPage Schema
How do I manage parallel Git worktrees for concurrent feature development?

Git worktrees let you manage parallel development by creating isolated working directories from a base branch. A dedicated manager script ensures consistent directory structure and environment variable parity, preventing manual setup errors during concurrent feature contexts.

How do I copy .env files to a new Git worktree automatically?

When creating a Git worktree, the manager script automatically copies .env* files, excluding .env.example, into the new working directory. This ensures environment variables remain consistent across parallel development contexts without manual file duplication.

What is the safest way to clean up inactive Git worktrees?

The safest way to clean up inactive Git worktrees is through an interactive confirmation prompt in the manager script. This prevents accidental deletions by requiring explicit approval before removing isolated working directories from your repository.

Can I use Git worktrees for PR review without losing my current environment setup?

Yes, Git worktrees support PR review without losing environment setup. The manager script creates isolated contexts for reviewing pull requests and automatically applies existing .env* files so the reviewed code runs with the correct configuration.

Why should I use a manager script instead of raw git worktree add commands?

Using a manager script instead of raw git worktree add enforces safety guardrails and environment parity. The script ensures .worktrees is gitignored, copies necessary .env* files, and provides interactive confirmations that standard Git commands lack.

How do I list and switch between multiple Git worktrees without losing context?

You list and switch between Git worktrees using the manager script, which displays a clear current status for each isolated context. This lets you move between parallel feature branches quickly while maintaining awareness of your active working directory.