git-worktree-manager

Create isolated Git worktrees with deterministic naming and port allocation.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires git, python3, pnpm, yarn, npm, bun, pip, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill eliminates the chaos of running multiple feature branches at once by preventing port collisions, ensuring environment consistency, and making worktree cleanup safe and repeatable.

Core Features & Use Cases

  • Deterministic parallel worktrees: Create (or reuse) worktrees with standardized paths and naming so each branch behaves like an isolated local app.
  • Collision-free port allocation: Allocate non-overlapping app/db/redis ports per worktree and persist them in a .worktree-ports.json file.
  • Env + optional dependency bootstrapping: Copy .env* files from the base repo into each worktree and optionally install dependencies based on detected lockfiles.
  • Safety-first cleanup: Detect stale worktrees, check for dirty working trees, determine merged status against a base branch, and optionally remove only when safe.

Quick Start

Prepare an isolated worktree for a new feature by running the manager script with your repo root, branch, worktree name, and base branch, then start your app using the allocated ports it outputs.

Frequently Asked Questions about git-worktree-manager

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

FAQPage Schema
How do I prevent port collisions when running parallel git worktrees for local development?

Parallel git worktree development prevents port collisions by allocating non-overlapping app, database, and Redis ports per worktree, persisting them in a `.worktree-ports.json` file to ensure isolated branches run simultaneously without conflict.

What is the safest way to clean up stale git worktrees without losing uncommitted changes?

Safe git worktree cleanup detects stale directories, checks for dirty working trees, and determines merge status against a base branch before optionally removing worktrees, ensuring uncommitted changes are preserved during branch isolation cleanup.

How do I sync environment variables and dependencies across multiple isolated git worktrees?

To sync environment variables across isolated git worktrees, the manager copies `.env*` files from the base repo into each worktree and optionally installs dependencies by detecting lockfiles for pnpm, yarn, npm, bun, or pip.

Can I assign deterministic ports for Docker Compose services running in parallel git worktrees?

Docker Compose setups can use deterministic port allocation for parallel git worktrees by creating standardized paths and assigning non-conflicting app and service ports, enabling multi-branch local development without network clashes.

Does git worktree parallel development support automated inputs for multi-agent workflows?

Git worktree parallel development supports multi-agent workflows by accepting JSON or stdin automation inputs to create isolated worktree directories with deterministic naming and environment synchronization.