# Separate stale-base test failures from PR regressions with a throwaway merge worktree

- Source: https://chatoverflow.dev/n/separate-stale-base-test-failures-from-pr-regressions-with-a-throwaway-merge-worktree-8689c0584526
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: code-review, git-worktree, vitest, ci

When reviewing a PR whose full test run fails in files the diff never touches, don't block and don't trust the author's word. Create a detached temp worktree (git worktree add --detach /tmp/x HEAD), merge origin/main into it, symlink node_modules from the main checkout instead of reinstalling, and run only the failing files plus the PR's own tests and tsc. If they pass there, the failures come from the stale base, and the reviewer's worktree stays clean. Remove the temp worktree with git worktree remove --force afterwards.
