'\" t
.\" Title: git-merge-tree
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 01/13/2023
.\" Manual: Git Manual
.\" Source: Git 2.39.1
.\" Language: English
.\"
.TH "GIT\-MERGE\-TREE" "1" "01/13/2023" "Git 2\&.39\&.1" "Git Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git-merge-tree \- Perform merge without touching index or working tree
.SH "SYNOPSIS"
.sp
.nf
\fIgit merge\-tree\fR [\-\-write\-tree] []
\fIgit merge\-tree\fR [\-\-trivial\-merge] (deprecated)
.fi
.sp
.SH "DESCRIPTION"
.sp
This command has a modern \fB\-\-write\-tree\fR mode and a deprecated \fB\-\-trivial\-merge\fR mode\&. With the exception of the DEPRECATED DESCRIPTION section at the end, the rest of this documentation describes modern \fB\-\-write\-tree\fR mode\&.
.sp
Performs a merge, but does not make any new commits and does not read from or write to either the working tree or index\&.
.sp
The performed merge will use the same feature as the "real" \fBgit-merge\fR(1), including:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
three way content merges of individual files
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
rename detection
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
proper directory/file conflict handling
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
recursive ancestor consolidation (i\&.e\&. when there is more than one merge base, creating a virtual merge base by merging the merge bases)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
etc\&.
.RE
.sp
After the merge completes, a new toplevel tree object is created\&. See \fBOUTPUT\fR below for details\&.
.SH "OPTIONS"
.PP
\-z
.RS 4
Do not quote filenames in the section, and end each filename with a NUL character rather than newline\&. Also begin the messages section with a NUL character instead of a newline\&. See
the section called \(lqOUTPUT\(rq
below for more information\&.
.RE
.PP
\-\-name\-only
.RS 4
In the Conflicted file info section, instead of writing a list of (mode, oid, stage, path) tuples to output for conflicted files, just provide a list of filenames with conflicts (and do not list filenames multiple times if they have multiple conflicting stages)\&.
.RE
.PP
\-\-[no\-]messages
.RS 4
Write any informational messages such as "Auto\-merging " or CONFLICT notices to the end of stdout\&. If unspecified, the default is to include these messages if there are merge conflicts, and to omit them otherwise\&.
.RE
.PP
\-\-allow\-unrelated\-histories
.RS 4
merge\-tree will by default error out if the two branches specified share no common history\&. This flag can be given to override that check and make the merge proceed anyway\&.
.RE
.SH "OUTPUT"
.sp
For a successful merge, the output from git\-merge\-tree is simply one line:
.sp
.if n \{\
.RS 4
.\}
.nf
.fi
.if n \{\
.RE
.\}
.sp
Whereas for a conflicted merge, the output is by default of the form:
.sp
.if n \{\
.RS 4
.\}
.nf
.fi
.if n \{\
.RE
.\}
.sp
These are discussed individually below\&.
.sp
However, there is an exception\&. If \fB\-\-stdin\fR is passed, then there is an extra section at the beginning, a NUL character at the end, and then all the sections repeat for each line of input\&. Thus, if the first merge is conflicted and the second is clean, the output would be of the form:
.sp
.if n \{\
.RS 4
.\}
.nf
NUL
NUL
.fi
.if n \{\
.RE
.\}
.SS "Merge status"
.sp
This is an integer status followed by a NUL character\&. The integer status is:
.sp
.if n \{\
.RS 4
.\}
.nf
0: merge had conflicts
1: merge was clean
<0: something prevented the merge from running (e\&.g\&. access to repository
objects denied by filesystem)
.fi
.if n \{\
.RE
.\}
.SS "OID of toplevel tree"
.sp
This is a tree object that represents what would be checked out in the working tree at the end of \fBgit merge\fR\&. If there were conflicts, then files within this tree may have embedded conflict markers\&. This section is always followed by a newline (or NUL if \fB\-z\fR is passed)\&.
.SS "Conflicted file info"
.sp
This is a sequence of lines with the format
.sp
.if n \{\
.RS 4
.\}
.nf