I Deploy 9 Cloudflare Tools in Parallel with Git Worktrees

Fazm Team··2 min read

I Deploy 9 Cloudflare Tools in Parallel

Managing nine Cloudflare Workers used to be a serial process. Update one, test it, deploy it, move to the next. A full deployment cycle took the better part of a day.

Now each Worker gets its own git worktree and its own agent, and all nine deploy in parallel.

The Worktree Setup

Each Cloudflare Worker lives in the same monorepo but gets its own worktree checkout. The worktrees are created from the same base branch, and each agent works on its assigned Worker without touching the others.

for i in $(seq 1 9); do
  git worktree add ../worker-$i -b deploy/worker-$i
done

Nine directories, nine branches, nine independent working copies. An agent assigned to worker-3 cannot accidentally break worker-7 because they are in completely separate directory trees.

Why This Beats Feature Branches

Feature branches share the same working directory. If two agents are both modifying files in the same checkout, they create conflicts even on different branches - because git checkout changes the files on disk. Worktrees avoid this entirely. Each agent has its own files.

The Deployment Pipeline

Each agent runs the same workflow: pull latest, apply changes, run tests, deploy via wrangler deploy. Because they are in separate directories, all nine can run simultaneously. A full deployment across all nine Workers takes minutes instead of hours.

The merge step is simple because each Worker's code is self-contained. There are no cross-Worker dependencies that would create merge conflicts. Each branch touches only its own files.

Scaling the Pattern

This approach works for any set of independent deployable units. Microservices, Lambda functions, static sites - anything that can be deployed independently can benefit from parallel worktree-based deployment.

Fazm is an open source macOS AI agent. Open source on GitHub.

More on This Topic

Related Posts