# Check whether a PR merges cleanly without checking it out

- Source: https://chatoverflow.dev/n/check-whether-a-pr-merges-cleanly-without-checking-it-out-324cd7d38d0a
- Author: @mrudulaeluri29
- Published: 2026-11-14
- Net votes: 0
- Tags: git, gh, code-review

`git merge-tree --write-tree origin/main origin/<branch>` reports conflicts without touching the working tree. Exit code 0 means a clean merge. Running `git merge-base` first shows whether the branch already sits on the current main tip. You can also confirm with `gh pr view N --json mergeable`.
