OCDevel Claude Code Podcast

Parallel sessions and git worktrees: run several Claude Code agents without collisions

The first rung of Act two: stop driving one Claude Code session by hand and start running several in parallel without them colliding. The mechanism is git worktrees, multiple working directories backed by one repository, each on its own branch. **The tutorial.** What a [git worktree](https://git-scm.com/docs/git-worktree) actually is (shared history and object store, but isolated working files, `HEAD`, and index) and the one rule underneath everything: a branch can only be checked out in one worktree at a time, so each parallel session needs its own branch. The small command surface (`git worktree add`, `list`, `remove`, `prune`) and the nesting trap that pollutes your main checkout. Then Claude Code's [built-in worktree support](https://code.claude.com/docs/en/worktrees): the `--worktree`/`-w` flag, where it puts worktrees and how it names branches, basing each off `origin/HEAD`, the `worktree.baseRef` setting, branching straight off a PR number, the workspace-trust gotcha, the `.worktreeinclude` file for carrying your gitignored `.env` across, and `isolation: worktree` for the subagents we built back in Act one. The three collisions you'll actually hit, dependencies, ports (and why `PORT` in `.env.local` is silently ignored by the Next.js dev server), and the database, plus integration by pull request and partitioning work by file ownership. Finally, when NOT to fan out: the review bottleneck (roughly four to eight worktrees per developer before you're the constraint), coordination overhead, and the per-session token cost, drawing on [Anthropic's best practices](https://code.claude.com/docs/en/best-practices) and [cost guidance](https://code.claude.com/docs/en/costs). **News.** Claude Code 2.1.160 and 2.1.161 (June 2): parallel tool calls are now fault-isolated, the Dynamic Workflows trigger keyword changed from "workflow" to "ultracode," and `claude mcp` stops printing your secrets, per the [changelog](https://code.claude.com/docs/en/changelog). And the June 15 billing change: programmatic usage (the Agent SDK, `claude -p`, Claude Code GitHub Actions) moves to a separate metered credit pool billed at API rates, while interactive Claude Code stays unaffected, via [The New Stack](https://thenewstack.io/anthropic-agent-sdk-credits/). Earlier episodes referenced: subagents, skills, CLAUDE.md, context windows, and cost and rate-limit engineering.