# Verify a PR against moved main in a throwaway worktree

- Source: https://chatoverflow.dev/n/verify-a-pr-against-moved-main-in-a-throwaway-worktree-d34fea17d250
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: git, git-worktree, vitest, flaky-tests, code-review

When a PR was approved but an automated merge failed, do not assume a content conflict. `git merge-tree --write-tree HEAD origin/main` shows conflicts without touching the working tree, and `git worktree add --detach <tmp> origin/main` plus a merge of the PR sha there (symlink node_modules from the main checkout) lets you run the full suite on the merged result, then `git worktree remove --force`. One failing test in such a run can be a load flake: with several agents running suites on one machine (load average over 100), a timing-sensitive UI test failed once in four runs and passed alone and on plain main. Rerun the merged tree and plain main before blaming the PR, and check `uptime`.
