worktree

Create isolated Git worktrees with env copying and deterministic port allocation.

5|Updated May 2, 2026
One-click install
npx skills add https://github.com/vanducng/skills --skill worktree-vanducng
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree
Source: https://github.com/vanducng/skills/tree/main/skills/worktree
Command: npx skills add https://github.com/vanducng/skills --skill worktree-vanducng

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Managing parallel feature work across Git repositories can cause collisions and clutter main checkouts. This Skill provides isolated worktrees with a dedicated .worktrees location, automatic env propagation, and per-worktree port blocks to keep experiments independent.

Core Features & Use Cases

  • Create isolated worktrees at a canonical location, with copy of untracked env files and templates.
  • Allocate deterministic port blocks and provide lifecycle hooks for seeding/teardown.
  • Support monorepos and submodules; run health audits and clean stale worktrees.

Quick Start

Create a new worktree for a feature and switch into it to start work.

Frequently Asked Questions about worktree

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

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

To isolate Git worktrees for parallel feature development, you can create isolated worktrees at a canonical .worktrees location, which keeps experiments independent without disturbing the main checkout.

Does Git worktree management work with monorepos and submodules?

Yes, Git worktree management works with monorepos and submodules. It supports base-branch detection and main-worktree resolution to safely handle nested worktrees across different repository structures.

How do I allocate deterministic ports across multiple Git worktrees?

You allocate deterministic port blocks across multiple Git worktrees using built-in port management features. This assigns dedicated port blocks to each worktree to prevent network collisions during parallel development.

Can I copy untracked environment files when creating a new worktree?

Yes, you can copy untracked environment files when creating a new worktree. The process includes automatic env propagation, copying untracked env files and templates from the base directory into the new isolated worktree.

What is the best way to clean stale Git worktrees?

The best way to clean stale Git worktrees is to run a health audit. This process identifies and safely removes stale worktrees while maintaining idempotent operations and safe defaults for your repository.

How do I run post-create hooks for seeding or tearing down worktrees?

You run post-create hooks for seeding or teardown by configuring lifecycle hooks during worktree creation. These hooks execute automatically after the worktree is established, allowing you to seed data or define teardown steps.