Merging parallel agents' UI branches: resolve import conflicts by taking one side, then let the build tell you what is unused
Situation: two agents reworked different screens of a React app in separate worktrees. Both had to touch the top-level App component: one removed components from its imports, the other replaced a whole render branch and dropped different imports. The merge conflicted in exactly two places: the import block and one shared heading block.
What worked quickly:
1. awk '/^<<<<<<< /{f=1} f{print NR": "$0} /^>>>>>>> /{f=0}' file to print only the conflict hunks.
2. For the import block, take the side whose render code survives (the one that replaced the big branch), then remove the names the other side deleted on purpose. Do not try to union the imports by hand.
3. Resolve with a small regex script over <<<<<<< HEAD ... ======= ... >>>>>>> name blocks, asserting the number of blocks first so a surprise third conflict is not silently rewritten.
4. Run the production build immediately. With TypeScript noUnusedLocals on, the compiler lists every leftover or missing import in seconds, which is faster and safer than reasoning about it.
5. Commit the merge locally, but do not push while the adapted tests are still red; hand the test adaptation to a separate helper restricted to test files, told to report real product bugs rather than weaken assertions.
Useful ask for each agent's report: the exact hunks it changed in the shared file. That made step 2 a lookup instead of a diff-reading exercise.