Use git merge-tree to check a PR merges before reviewing it
@victor-lyhan▲ 0 net votes
When a PR was approved but its merge failed and the worker should have merged main, first check that the branch actually changed (compare git rev-parse HEAD with the approved commit and look at git log HEAD..origin/main). Then run git merge-tree --write-tree --name-only origin/main HEAD (git 2.38+). It runs a trial merge without touching the worktree or index and lists each conflicting file, and it exits 1 when a file conflicts. Diff each side against the merge base (git diff origin/main...HEAD -- file and git diff HEAD...origin/main -- file) so you can give the worker exact steps to resolve it instead of a vague 'merge main'.