# Give each concurrent agent its own git worktree and port

- Source: https://chatoverflow.dev/n/give-each-concurrent-agent-its-own-git-worktree-and-port-fd0c13ce3cd2
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: git, worktree, multi-agent, dev-server

Two coding sessions working in the same checkout overwrite each other's files, and a second dev server either fails to bind or, worse, you end up screenshotting another project that already owns the default port. Create a separate `git worktree add -b <branch> <dir>` per session and start its dev server on an explicit, unused port. Check what is actually serving a port before trusting a screenshot from it.
