Courses / Build Your First Software Factory Execution HarnessProLesson 4 of 43:15

Stop Parallel Agents Sharing One Branch

Five coding agents committing to one local branch give you a 120-file pull request that nobody can verify. One git worktree per task brings every change back to two or three files a reviewer can read.

Chapters

  1. Babysitting terminal windows
  2. Five agents, one branch
  3. The 120-file pull request
  4. One git worktree per task
  5. The worktree commands

Transcript

Babysitting terminal windows

are you babysitting multiple terminal windows in with your coding agent, whether you are using Claude code, whether you are using cursor or whatever coding agent you are using. Are you babysitting right now?

Five agents, one branch

I used to do so. This is how I often does when we are working in a mono repo, then we have five different tasks to be done. we spin up agent one, agent two, agent three, agent four, agent five, or we have five different you know tabs open and everything will be committing to the same place locally. Then you know we can't able to verify what did what and whether this is the change which will be you know correct or wrong. we we can't verify that because it is all in single branch.

The 120-file pull request

So what are all the problems which will happen if we are going to commit it with every agent? One thing is these agents are running in parallel, but it is committing everything to the same local. Then if you are creating the pull request, it will be 120 file change rather than three file change. Now, how do you know which task corresponds to what change? then you will you won't be able to verify, and your fellow engineer who is going to do the PR review is not able to verify as well. Also, you yourself, how do you know everything has been completed? How do you verify that that all the tasks with all you know full-fledged verification is like full-fledged output is there for all the task. So this becomes even more crucial when you have multi-team environment, then automatically it will become a very big black box that your output is not granular enough for verification.

One git worktree per task

now let's come into you know code collision issue what we are talking about, which can be easily solved with a simple git practice called git work tree. You can create git work tree, which is not exactly an isolated environment, but it is more like an isolated branch where you can create that work tree and you can make those changes, then you will be able to, you know, securely you can change your own changes. So automatically your one PR is not going to be 120 lines, but it will be three files, 120 files, it can be just three files, two files, and then automatically you solve the problem of reviewing.

The worktree commands

You can create the git work tree with this comment. You can create git work tree add try as the work tree name, and you can create the branch try, something like that, and you can list down what are all the work tree which is there in the parent repository, and then you can push those repository.

This lesson comes with Pro, $149 a year: Get Pro. This lesson is cut from the free Lightning session Build Your First Software Factory Execution Harness. The Live Labs build the same system with you, free, on Thursdays: see the Live Labs.

That was the last lesson. Pro members watch every Lightning session cut the same way: Get Pro. Not sure what to learn next? Take the 2-minute assessment.