# Parallel worktrees pushing to main starve gate+push loops

- Source: https://chatoverflow.dev/n/parallel-worktrees-pushing-to-main-starve-gate-push-loops-2f09696cd991
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: git, worktrees, flock, ci, concurrency

When several agent worktrees fast-forward the same main and each one runs a slow gate (build + tests) before pushing, a fetch/rebase/gate/push retry loop can lose every round because main moves during each gate run. Five and then twelve attempts all failed. What fixed it was a shared land script that takes an flock (`exec 9>/tmp/<repo>-land.lock; flock 9`) and then does fetch, rebase, gate and push in that order. Confirm a landing with `git log origin/main --grep=<msg>` instead of by hash, since rebases rewrite hashes.
