git-treeline

Isolated environments for every worktree

Allocates unique ports, databases, and Redis namespaces per git worktree so parallel development — human or AI — never collides.

brew install git-treeline/tap/git-treeline
View on GitHub

The problem

AI agents and parallel development mean multiple worktrees running at the same time. They all fight over port 3000, the same database, the same Redis instance. One collision kills the whole flow.

without git-treeline

~/feature-a $ rails server

=> Booting Puma on http://localhost:3000

~/feature-b $ rails server

Address already in use - bind(2) for "127.0.0.1" port 3000 (Errno::EADDRINUSE)

How it works

01

Allocate

Unique ports, database names, and Redis namespaces assigned per worktree. No manual coordination needed.

02

Configure

.treeline.yml describes what your project needs. config.json controls your machine.

03

Manage

status, release, prune to inspect and clean up allocations across worktrees.

See it in action

terminal

~/myapp $ git worktree add ../myapp-feature-auth

Preparing worktree (new branch 'feature-auth')

~/myapp-feature-auth $ git-treeline setup .

Allocated resources for worktree myapp-feature-auth

PORT=3001 DB=myapp_dev_wt1 REDIS_NS=wt1

Wrote .env

~/myapp-feature-auth $ git-treeline status

┌──────────────────────┬──────┬─────────────────┬──────────┐

WorktreePortDatabaseRedis

├──────────────────────┼──────┼─────────────────┼──────────┤

│ myapp (main) │ 3000myapp_devdefault

│ myapp-feature-auth │ 3001myapp_dev_wt1wt1

│ myapp-fix-payments │ 3002myapp_dev_wt2wt2

└──────────────────────┴──────┴─────────────────┴──────────┘

Works with any stack

Anything that reads PORT from the environment works out of the box. Rails, Next.js, Express, FastAPI — whatever your team runs.

.treeline.yml
resources:
  port:
    range: [3000, 3099]
  database:
    template: "myapp_dev_{{.Suffix}}"
  redis:
    namespace: true

Rails integration

The git-treeline-rails gem automatically injects allocated environment variables into your Rails app via a Railtie. Zero config.

gem "git-treeline-rails"

Built for AI agents

AI coding agents spin up worktrees to work in parallel. Git Treeline handles resource isolation so agents don't collide with each other or with your local dev server.

agent lifecycle hook

$ git-treeline setup .

Allocated resources for worktree agent-task-42

programmatic access

$ git-treeline status --json

{
  "worktree": "agent-task-42",
  "port": 3003,
  "database": "myapp_dev_wt3"
}

Install

Homebrew

brew install git-treeline/tap/git-treeline

Go

go install github.com/git-treeline/git-treeline@latest