git-worktree

Automate Git worktree creation, listing, switching, and cleanup via Bash scripts.

Updated Jan 1, 2026
One-click install
npx skills add https://github.com/jayteealao/blank-template --skill git-worktree-jayteealao
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-worktree
Source: https://github.com/jayteealao/blank-template/tree/main/.claude/skills/git-worktree
Command: npx skills add https://github.com/jayteealao/blank-template --skill git-worktree-jayteealao

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Managing Git worktrees can be error-prone and manual, especially when reviewing PRs or developing features in parallel. This skill provides a unified interface to create, list, switch, and cleanup worktrees while keeping environment consistency.

Core Features & Use Cases

  • Create worktrees from a main branch with predictable naming
  • List existing worktrees and their current status
  • Switch between worktrees and quickly access them
  • Clean up inactive worktrees with safety confirmations
  • Auto-manage .gitignore and copy environment files (.env*) to new worktrees
  • Interactive prompts to prevent accidental destructive actions

Quick Start

Use the git-worktree manager to:

  • Create a new worktree: bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh create feature-login
  • List worktrees: bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh list
  • Switch to a worktree: bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh switch feature-login
  • Copy env files to an existing worktree: bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh copy-env feature-login
  • Cleanup inactive worktrees: bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh cleanup

Frequently Asked Questions about git-worktree

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

FAQPage Schema
How do I manage Git worktrees for parallel development without manual errors?

You can automate Git worktree management using a Bash script that creates isolated worktrees from a main branch, copies environment files, updates .gitignore, and provides interactive prompts to prevent accidental destructive actions during parallel development.

What is the best way to copy environment files to a new Git worktree?

The best way to copy environment files to a new Git worktree is using a dedicated manager script that automatically duplicates .env files and updates .gitignore during worktree creation, or via a specific copy-env command for existing worktrees.

How do I safely clean up inactive Git worktrees?

To safely clean up inactive Git worktrees, you can run a cleanup command that uses interactive prompts to prevent accidental destructive actions, ensuring inactive worktrees are removed only after explicit confirmation.

Can I use Bash to automate Git worktree creation and switching for PR reviews?

Yes, you can use a Bash-based manager script to automate Git worktree creation and switching, which is specifically applicable when reviewing PRs or developing multiple features in parallel from a main branch.

Does Git worktree management handle .gitignore updates automatically?

Yes, Git worktree management via this script automatically updates .gitignore when creating new worktrees, ensuring environment files and worktree directories are properly ignored in the main repository.

When do I need to use Git worktrees instead of standard Git branches?

You need Git worktrees when developing multiple features in parallel or reviewing PRs, as they enable isolated directory environments for each branch without stashing changes or cloning the repository multiple times.