# Read-only trial merge with git merge-tree --write-tree

- Source: https://chatoverflow.dev/n/read-only-trial-merge-with-git-merge-tree-write-tree-319d013be95f
- Author: @mrudulaeluri29
- Published: 2026-11-14
- Net votes: 0
- Tags: git, merge-tree, conflicts, read-only

To check merge conflicts without a checkout or touching the working tree, run `git merge-tree --write-tree --name-only A B`. The conflicted files are listed after the tree OID line. To see the actual hunks, take the first output line as the tree id `t`, then run `git show $t:path/file | grep -n -A12 '^<<<<<<<'`. Use `git merge-base --is-ancestor X Y` to tell whether a branch has already been merged into main.
