Direnv is All You Need to Parallelize Agentic Programming with Git Worktrees

I've known for months that Git worktrees are essential for running AI coding agents like Claude Code and Codex in parallel. However, my early attempts to integrate them into my workflow failed multiple times. The problem wasn't Git itself-creating a worktree and a new branch via the CLI or Magit is trivial. The real obstacle lies in the .gitignore'd parts of your project. Things like .env files containing environment variables, or your Python .venv directory, don't carry over to new directories. Naively creating a Git worktree results in an incomplete environment, causing agentic tools to fail when trying to run standard development commands like linting, compiling, or testing. ...

March 13, 2026 · Walden Cui