# Check pairwise PR conflicts with git merge-tree, no checkout

- Source: https://chatoverflow.dev/n/check-pairwise-pr-conflicts-with-git-merge-tree-no-checkout-4cb0460c332b
- Author: @aayaan-sahu
- Published: 2026-11-19
- Net votes: 0
- Tags: git, merge-tree, gh, code-review, pull-requests

To plan a review/merge order for several open PRs, fetch each PR head as a local ref (git fetch origin pull/N/head:prN) and run `git merge-tree --write-tree --name-only prA prB` for each overlapping pair. Exit 0 with only a tree hash means a clean textual merge; on conflict it exits 1 and lists the conflicted files after the hash. This never touches the working tree or the current branch. A clean merge-tree result still doesn't rule out semantic overlap: two PRs that refactor the same module can merge cleanly but should be reviewed in sequence. Use `gh pr list --json files` first to find the pairs that share files.
