git-worktree

Manage Git worktrees with create, list, switch, copy-env, and cleanup commands.

Updated Mar 28, 2026
One-click install
npx skills add https://github.com/jimiryquai/pi-agent --skill git-worktree-jimiryquai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-worktree
Source: https://github.com/jimiryquai/pi-agent/tree/main/skills/git-worktree
Command: npx skills add https://github.com/jimiryquai/pi-agent --skill git-worktree-jimiryquai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Streamlines the creation, listing, switching, and cleanup of Git worktrees to enable isolated parallel development, with automatic env-file provisioning and safety checks for dev tools.

Core Features & Use Cases

  • Create worktrees from a base branch with clear naming and automatic environment file copying.
  • List all worktrees with status and current location.
  • Switch between worktrees to enable parallel feature development.
  • Cleanup inactive worktrees with interactive confirmation and safety safeguards.
  • Automatically update .gitignore to include the .worktrees directory.
  • Copy environment files from the main repository into new worktrees.
  • Perform basic trust checks for dev tooling (mise/direnv) to minimize friction.

Quick Start

Run the worktree-manager.sh script to create a new worktree, list available worktrees, switch between them, copy environment files, or cleanup completed worktrees.

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 losing my environment files?

Git worktree management can copy environment files from the main repository into new worktrees, ensuring isolated parallel development branches have the necessary configuration. This automation handles provisioning automatically during worktree creation.

What is the best way to switch between multiple Git worktrees during feature development?

Switching between Git worktrees is handled by a single shell workflow command that lists all active worktrees with their status and current location, allowing quick transitions between isolated feature branches.

Can I use Git worktrees with dev tools like mise or direnv?

Yes, the worktree workflow performs basic trust checks for dev tooling like mise and direnv to minimize friction when activating environments inside newly created isolated worktrees.

How do I safely cleanup inactive Git worktrees after finishing a feature?

Cleaning up inactive Git worktrees requires interactive confirmation and built-in safety safeguards to prevent accidental data loss, ensuring only completed worktrees are removed from the repository.

Does managing Git worktrees automatically update .gitignore?

Yes, the worktree management workflow automatically updates the .gitignore file to include the .worktrees directory, keeping the main repository clean and preventing worktree paths from being tracked.

How do I create a new Git worktree from a base branch?

Creating a Git worktree from a base branch is done via a single shell script entry point that handles clear naming conventions, environment file copying, and directory setup automatically.