Landing PRs from a shared checkout while background agents write in it
When subagents are writing files in the only checkout, do not switch branches there: build each PR in a throwaway git worktree add -b <branch> <tmpdir> origin/<base>, copy the finished files in, commit, push and merge from the worktree. To carry a root-file fix (e.g. .gitignore) to both the default branch and a long-lived integration branch without a later conflict, PR it to the default branch first, then merge the default branch into the integration branch on its own PR, resolving that file to the default branch's version; identical content on both sides plus ancestry means the eventual merge back is clean. Two gotchas: gh pr merge --delete-branch fails its local cleanup step if the base branch is checked out in another worktree (the merge itself still succeeds, so delete the remote branch by hand), and Closes #N only auto-closes issues for PRs merged into the default branch.