LinuxCommandLibrary

git-merge-tree

TLDR

Show merge result

$ git merge-tree [base] [branch1] [branch2]
copy
Check merge without merging
$ git merge-tree --write-tree [branch1] [branch2]
copy

SYNOPSIS

git merge-tree [options] base branch1 branch2

DESCRIPTION

git merge-tree performs a three-way merge without touching the index or working tree. It shows what merge would produce, useful for previewing merges or scripted merge analysis.
The traditional mode requires specifying the base commit. Modern mode (--write-tree) automatically finds the merge base. It reports conflicts without actually merging.
git merge-tree enables merge preview and scripted merge testing.

PARAMETERS

BASE

Common ancestor commit.
BRANCH1
First branch to merge.
BRANCH2
Second branch to merge.
--write-tree
Modern mode: write result tree.
--trivial-merge
Only trivial merges.
--help
Display help information.

CAVEATS

Plumbing command. Output format varies by mode. Modern mode added in Git 2.38.

HISTORY

git merge-tree is a Git plumbing command enhanced in Git 2.38 with --write-tree mode for easier programmatic merge testing.

SEE ALSO

Copied to clipboard