git-worktree

Automates Git worktree creation, listing, switching, cleanup with .env copying and mise/direnv trust management.

Updated Nov 11, 2023
One-click install
npx skills add https://github.com/michaelvolz/redmuffin.Blazor.StaticWeb --skill git-worktree-michaelvolz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-worktree
Source: https://github.com/michaelvolz/redmuffin.Blazor.StaticWeb/tree/main/.opencode/skills/ce/git-worktree
Command: npx skills add https://github.com/michaelvolz/redmuffin.Blazor.StaticWeb --skill git-worktree-michaelvolz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires mise, direnv, and includes scripts (resource) components.

What problem does it solve?

Managing multiple Git contexts, ensuring env files and trusted tooling stay synchronized, and cleaning up completed branches are all error-prone when done manually; this skill coordinates worktree creation, trust handling, and cleanup through a single interactive manager.

Core Features & Use Cases

  • Create, list, and switch worktrees with consistent naming, .worktrees storage, and automatic .gitignore updates so parallel development stays organized.
  • Copy environment files and trust mise/direnv configs from trusted baselines to avoid blocked hooks and untrusted prompts in each new worktree.
  • Interactive cleanup and safety checks keep review or feature work isolated and remove inactive worktrees after you finish.
  • Use case: When preparing an isolated PR review, spin up a new worktree from main, review safely with copied env variables, and clean up when done without touching your main branch.

Quick Start

Run bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh create feature-login from main before beginning your isolated review so all env files and trust settings are ready.

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 feature branches without manually copying environment files?

Git worktree management can be automated to handle creating, listing, switching, and cleaning up isolated worktrees. This ensures environment files and tooling configurations are automatically copied from a trusted baseline, keeping parallel development contexts synchronized without manual file operations.

What is the best way to set up an isolated Git worktree for pull request review?

Setting up an isolated Git worktree for pull request review involves spinning up a new worktree from the main branch. This keeps the review safely separated from your main working directory, with environment variables copied over, and allows for easy cleanup when the review is complete without affecting your primary branch.

Do I need mise and direnv installed to automate worktree creation and trust handling?

Yes, mise and direnv are required dependencies for automating worktree creation and trust handling. The automation script applies trust settings for these tools from trusted baselines to each new worktree, preventing blocked hooks and untrusted prompt interruptions during parallel development.

How does automated worktree management handle environment configuration and directory organization?

Automated worktree management handles environment configuration by copying .env files and applying trust settings for mise and direnv. It organizes directories by storing all isolated worktrees in a dedicated .worktrees directory and automatically updating .gitignore to keep parallel development workflows structured.

Can I use a shell script to clean up completed Git worktrees and inactive feature branches?

Yes, a single interactive shell script can perform cleanup of completed Git worktrees and inactive feature branches. It includes safety checks to keep review or feature work isolated and removes inactive worktrees from the dedicated .worktrees directory after you finish your tasks.

Why does creating a new Git worktree manually cause issues with trusted tooling configurations?

Creating a Git worktree manually often causes issues with trusted tooling because environment files and mise/direnv configurations are not automatically synchronized. This leads to blocked hooks and untrusted prompt interruptions, which automated worktree management resolves by copying settings from trusted baselines.