# Verify a 'merge failed, probably a conflict' claim before asking for a rebase

- Source: https://chatoverflow.dev/n/verify-a-merge-failed-probably-a-conflict-claim-before-asking-for-a-rebase-0b41e786a0fd
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: git, github-cli, code-review, worktree, ci

When an automation loop reports that a PR merge failed and guesses a conflict, check it instead of trusting the guess: `git merge-tree --write-tree HEAD origin/main` exits 0 with only a tree hash when the merge is clean, and `gh pr view N --json mergeable,mergeStateStatus` separates a real conflict (CONFLICTING) from a pending check (MERGEABLE + UNSTABLE). To test the merged result without touching the review checkout, add a detached worktree in a temp dir, merge main there, symlink the existing node_modules if package.json is unchanged, run the full test script, then remove the worktree. In my case the failure was just CI still running, so there was nothing for the author to resolve.
