Part of Forge DevKit ecosystem

forge-worktree

Parallel branches, zero port conflicts

The problem

Feature branches collide on localhost

Two branches, same port 3000. You kill one server to run another. Context lost.

Docker containers fight for ports

Backend on 5432, Redis on 6379 - but your second worktree wants the same ports.

Manual worktree setup is error-prone

Copy .env, remap ports, adjust Docker Compose, remember to clean up. Every time.

How it works

1

Install

One command adds forge-worktree to your environment.

forge install forge-worktree
2

Audit

Detects your project type: Docker backend, frontend, or generic. Scans ports, env files, compose configs.

Type: Docker backend
Ports: 3000, 5432, 6379
3

Generate

Produces a worktree management skill with port offsets, env remapping, and cleanup scripts.

4

Use

Create worktrees with one command. Each gets isolated ports, its own Docker stack, safe teardown.

Key capabilities

3 project templates

Docker backend, Frontend, Non-Docker (Node, Python, Go). Each with template-specific port isolation and env handling.

Zero port conflicts

Automatic port offset per worktree. Main on 3000, worktree-1 on 3100, worktree-2 on 3200.

Docker isolation

Each worktree gets its own Docker Compose project name, volumes, and network namespace.

Safe teardown

One command stops containers, removes volumes, and cleans the worktree. No orphaned resources.

Auto-cleanup on merge

When a branch is merged, the worktree and its resources are cleaned up automatically. No orphaned Docker resources accumulating on your machine.

Sample output

A real-world example of what this module produces.

forge:worktree-setup - Create Worktree
 Creating worktree: feat-sso

created  Branch:    feat/sso-login
created  Worktree:  ../taskflow-app-wt/feat-sso/
created  Port:      3001 (main: 3000, isolated)
created  Docker:    taskflow-feat-sso-db (port 5433)
copied   .env       with port overrides applied

Ready. Run from: cd ../taskflow-app-wt/feat-sso

Who is this for

Docker Backend Dev

Each worktree gets isolated ports and its own Docker stack - no conflicts.

Team with Parallel PRs

Run multiple feature branches simultaneously without killing servers.

CI/CD Engineer

Automated worktree lifecycle with safe teardown - no orphaned resources.

forge-worktree vs Manual git worktrees

Dimension Manual git worktrees Forge DevKit
Port management Manual port remapping per branch Automatic offset (3000 -> 3100 -> 3200)
Docker handling Shared containers, manual compose overrides Isolated project names, volumes, networks
Cleanup Manual: stop containers, remove worktree, hope nothing's left One command: containers, volumes, worktree - all clean
Setup time 15-30 min per worktree (copy env, remap, test) One command, auto-configured
Get Forge →