/usr/share/doc/git
NameSizeModeActions
contrib/-0755rm
howto/-0755rm
RelNotes/-0755rm
technical/-0755rm
blame-options.txt60010644editdlrm
cmds-ancillaryinterrogators.txt12940644editdlrm
cmds-ancillarymanipulators.txt7460644editdlrm
cmds-developerinterfaces.txt6780644editdlrm
cmds-foreignscminterface.txt3990644editdlrm
cmds-guide.txt8330644editdlrm
cmds-mainporcelain.txt30330644editdlrm
cmds-plumbinginterrogators.txt15390644editdlrm
cmds-plumbingmanipulators.txt14100644editdlrm
cmds-purehelpers.txt12680644editdlrm
cmds-synchelpers.txt4490644editdlrm
cmds-synchingrepositories.txt3970644editdlrm
cmds-userinterfaces.txt5070644editdlrm
CODE_OF_CONDUCT.md59890644editdlrm
config.txt180010644editdlrm
date-formats.txt11720644editdlrm
diff-format.txt65730644editdlrm
diff-generate-patch.txt72530644editdlrm
diff-options.txt324360644editdlrm
docbook-xsl.css45570644editdlrm
everyday.html169960644editdlrm
fetch-options.txt122810644editdlrm
fsck-msgids.txt41970644editdlrm
git-add.html403690644editdlrm
git-add.txt161640644editdlrm
git-am.html331610644editdlrm
git-am.txt93170644editdlrm
git-annotate.html283910644editdlrm
git-annotate.txt7710644editdlrm
git-apply.html334070644editdlrm
git-apply.txt109500644editdlrm
git-archive.html298560644editdlrm
git-archive.txt84910644editdlrm
git-bisect-lk2009.html812430644editdlrm
git-bisect-lk2009.txt496940644editdlrm
git-bisect.html405720644editdlrm
git-bisect.txt179050644editdlrm
git-blame.html425010644editdlrm
git-blame.txt87320644editdlrm
git-branch.html482530644editdlrm
git-branch.txt157480644editdlrm
git-bugreport.html205090644editdlrm
git-bugreport.txt24210644editdlrm
git-bundle.html332690644editdlrm
git-bundle.txt117030644editdlrm
git-cat-file.html386610644editdlrm
git-cat-file.txt136150644editdlrm
git-check-attr.html226330644editdlrm
git-check-attr.txt33900644editdlrm
git-check-ignore.html231350644editdlrm
git-check-ignore.txt41560644editdlrm
git-check-mailmap.html188160644editdlrm
git-check-mailmap.txt11080644editdlrm
git-check-ref-format.html240400644editdlrm
git-check-ref-format.txt50340644editdlrm
git-checkout-index.html253620644editdlrm
git-checkout-index.txt56690644editdlrm
git-checkout.html527190644editdlrm
git-checkout.txt223620644editdlrm
git-cherry-pick.html310650644editdlrm
git-cherry-pick.txt87640644editdlrm
git-cherry.html224230644editdlrm
git-cherry.txt36150644editdlrm
git-clean.html239810644editdlrm
git-clean.txt45230644editdlrm
git-clone.html443280644editdlrm
git-clone.txt147720644editdlrm
git-column.html233170644editdlrm
git-column.txt22010644editdlrm
git-commit-graph.html261470644editdlrm
git-commit-graph.txt59490644editdlrm
git-commit-tree.html266830644editdlrm
git-commit-tree.txt27100644editdlrm
git-commit.html571540644editdlrm
git-commit.txt215750644editdlrm
git-config.html4155400644editdlrm
git-config.txt197550644editdlrm
git-contacts.html207180644editdlrm
git-contacts.txt25840644editdlrm
git-count-objects.html189460644editdlrm
git-count-objects.txt13500644editdlrm
git-credential-cache--daemon.html181820644editdlrm
git-credential-cache--daemon.txt8910644editdlrm
git-credential-cache.html201800644editdlrm
git-credential-cache.txt24840644editdlrm
git-credential-store.html220430644editdlrm
git-credential-store.txt36370644editdlrm
git-credential.html266760644editdlrm
git-credential.txt73270644editdlrm
git-describe.html282680644editdlrm
git-describe.txt83190644editdlrm
git-diagnose.html201570644editdlrm
git-diagnose.txt22080644editdlrm
git-diff-files.html791300644editdlrm
git-diff-files.txt12250644editdlrm
git-diff-index.html843510644editdlrm
git-diff-index.txt48110644editdlrm
git-diff-tree.html1160520644editdlrm
git-diff-tree.txt41840644editdlrm
git-diff.html1070930644editdlrm
git-diff.txt80390644editdlrm
git-difftool.html270480644editdlrm
git-difftool.txt46240644editdlrm
git-fast-export.html316500644editdlrm
git-fast-export.txt112820644editdlrm
git-fast-import.html1032830644editdlrm
git-fast-import.txt599630644editdlrm
git-fetch-pack.html232550644editdlrm
git-fetch-pack.txt42480644editdlrm
git-fetch.html754560644editdlrm
git-fetch.txt118120644editdlrm
git-filter-branch.html546480644editdlrm
git-filter-branch.txt310310644editdlrm
git-fmt-merge-msg.html214350644editdlrm
git-fmt-merge-msg.txt19310644editdlrm
git-for-each-ref.html434380644editdlrm
git-for-each-ref.txt170730644editdlrm
git-for-each-repo.html192960644editdlrm
git-for-each-repo.txt15430644editdlrm
git-format-patch.html818420644editdlrm
git-format-patch.txt288760644editdlrm
git-fsck-objects.html173920644editdlrm
git-fsck-objects.txt3540644editdlrm
git-fsck.html391620644editdlrm
git-fsck.txt58820644editdlrm
git-fsmonitor--daemon.html228750644editdlrm
git-fsmonitor--daemon.txt36100644editdlrm
git-gc.html366970644editdlrm
git-gc.txt62920644editdlrm
git-get-tar-commit-id.html178350644editdlrm
git-get-tar-commit-id.txt7530644editdlrm
git-grep.html360300644editdlrm
git-grep.txt107630644editdlrm
git-hash-object.html199390644editdlrm
git-hash-object.txt21420644editdlrm
git-help.html281410644editdlrm
git-help.txt75270644editdlrm
git-hook.html188070644editdlrm
git-hook.txt10280644editdlrm
git-http-backend.html309740644editdlrm
git-http-backend.txt114720644editdlrm
git-http-fetch.html196790644editdlrm
git-http-fetch.txt17750644editdlrm
git-http-push.html213910644editdlrm
git-http-push.txt29950644editdlrm
git-imap-send.html254720644editdlrm
git-imap-send.txt35670644editdlrm
git-index-pack.html247350644editdlrm
git-index-pack.txt52050644editdlrm
git-init-db.html174600644editdlrm
git-init-db.txt4090644editdlrm
git-init.html266040644editdlrm
git-init.txt58690644editdlrm
git-interpret-trailers.html420060644editdlrm
git-interpret-trailers.txt185790644editdlrm
git-log.html1824850644editdlrm
git-log.txt68640644editdlrm
git-ls-files.html350530644editdlrm
git-ls-files.txt116220644editdlrm
git-ls-remote.html243490644editdlrm
git-ls-remote.txt48410644editdlrm
git-ls-tree.html256280644editdlrm
git-ls-tree.txt55150644editdlrm
git-mailinfo.html234020644editdlrm
git-mailinfo.txt38660644editdlrm
git-mailsplit.html192640644editdlrm
git-mailsplit.txt13420644editdlrm
git-maintenance.html460000644editdlrm
git-maintenance.txt189010644editdlrm
git-merge-base.html283800644editdlrm
git-merge-base.txt77590644editdlrm
git-merge-file.html226560644editdlrm
git-merge-file.txt37180644editdlrm
git-merge-index.html204500644editdlrm
git-merge-index.txt24450644editdlrm
git-merge-one-file.html174160644editdlrm
git-merge-one-file.txt3870644editdlrm
git-merge-tree.html334960644editdlrm
git-merge-tree.txt119230644editdlrm
git-merge.html710050644editdlrm
git-merge.txt150680644editdlrm
git-mergetool--lib.html191270644editdlrm
git-mergetool--lib.txt14670644editdlrm
git-mergetool.html397950644editdlrm
git-mergetool.txt44730644editdlrm
git-mktag.html198190644editdlrm
git-mktag.txt17820644editdlrm
git-mktree.html184740644editdlrm
git-mktree.txt10750644editdlrm
git-multi-pack-index.html235950644editdlrm
git-multi-pack-index.txt46320644editdlrm
git-mv.html200920644editdlrm
git-mv.txt21030644editdlrm
git-name-rev.html216700644editdlrm
git-name-rev.txt33520644editdlrm
git-notes.html410460644editdlrm
git-notes.txt138660644editdlrm
git-pack-objects.html423910644editdlrm
git-pack-objects.txt192970644editdlrm
git-pack-redundant.html197990644editdlrm
git-pack-redundant.txt18760644editdlrm
git-pack-refs.html211200644editdlrm
git-pack-refs.txt31360644editdlrm
git-patch-id.html203540644editdlrm
git-patch-id.txt24300644editdlrm
git-prune-packed.html185390644editdlrm
git-prune-packed.txt9460644editdlrm
git-prune.html203270644editdlrm
git-prune.txt19190644editdlrm
git-pull.html770700644editdlrm
git-pull.txt83540644editdlrm
git-push.html749930644editdlrm
git-push.txt280610644editdlrm
git-quiltimport.html194660644editdlrm
git-quiltimport.txt16930644editdlrm
git-range-diff.html316730644editdlrm
git-range-diff.txt103370644editdlrm
git-read-tree.html390780644editdlrm
git-read-tree.txt168970644editdlrm
git-rebase.html989450644editdlrm
git-rebase.txt472280644editdlrm
git-receive-pack.html304480644editdlrm
git-receive-pack.txt95260644editdlrm
git-reflog.html235140644editdlrm
git-reflog.txt45750644editdlrm
git-remote-ext.html230120644editdlrm
git-remote-ext.txt39770644editdlrm
git-remote-fd.html195010644editdlrm
git-remote-fd.txt16280644editdlrm
git-remote-helpers.html169740644editdlrm
git-remote.html299030644editdlrm
git-remote.txt87680644editdlrm
git-repack.html328190644editdlrm
git-repack.txt110200644editdlrm
git-replace.html248580644editdlrm
git-replace.txt52110644editdlrm
git-request-pull.html202950644editdlrm
git-request-pull.txt20350644editdlrm
git-rerere.html270400644editdlrm
git-rerere.txt77810644editdlrm
git-reset.html445200644editdlrm
git-reset.txt191250644editdlrm
git-restore.html281660644editdlrm
git-restore.txt70820644editdlrm
git-rev-list.html1181280644editdlrm
git-rev-list.txt32200644editdlrm
git-rev-parse.html646410644editdlrm
git-rev-parse.txt158400644editdlrm
git-revert.html267920644editdlrm
git-revert.txt54210644editdlrm
git-rm.html275840644editdlrm
git-rm.txt72360644editdlrm
git-send-pack.html245760644editdlrm
git-send-pack.txt51600644editdlrm
git-sh-i18n--envsubst.html181660644editdlrm
git-sh-i18n--envsubst.txt9280644editdlrm
git-sh-i18n.html185950644editdlrm
git-sh-i18n.txt11470644editdlrm
git-sh-setup.html212770644editdlrm
git-sh-setup.txt29760644editdlrm
git-shell.html214140644editdlrm
git-shell.txt29810644editdlrm
git-shortlog.html646180644editdlrm
git-shortlog.txt44090644editdlrm
git-show-branch.html268130644editdlrm
git-show-branch.txt65890644editdlrm
git-show-index.html195210644editdlrm
git-show-index.txt14730644editdlrm
git-show-ref.html260750644editdlrm
git-show-ref.txt66480644editdlrm
git-show.html1116440644editdlrm
git-show.txt19290644editdlrm
git-sparse-checkout.html439490644editdlrm
git-sparse-checkout.txt212580644editdlrm
git-stage.html173410644editdlrm
git-stage.txt2990644editdlrm
git-stash.html385940644editdlrm
git-stash.txt149990644editdlrm
git-status.html457180644editdlrm
git-status.txt202950644editdlrm
git-stripspace.html200160644editdlrm
git-stripspace.txt19460644editdlrm
git-submodule.html455810644editdlrm
git-submodule.txt208190644editdlrm
git-subtree.html368230644editdlrm
git-subtree.txt136870644editdlrm
git-switch.html333140644editdlrm
git-switch.txt86070644editdlrm
git-symbolic-ref.html204520644editdlrm
git-symbolic-ref.txt23270644editdlrm
git-tag.html389580644editdlrm
git-tag.txt134690644editdlrm
git-tools.html172070644editdlrm
git-tools.txt4220644editdlrm
git-unpack-file.html176450644editdlrm
git-unpack-file.txt4340644editdlrm
git-unpack-objects.html188110644editdlrm
git-unpack-objects.txt12200644editdlrm
git-update-index.html497230644editdlrm
git-update-index.txt239280644editdlrm
git-update-ref.html259090644editdlrm
git-update-ref.txt62980644editdlrm
git-update-server-info.html182550644editdlrm
git-update-server-info.txt8010644editdlrm
git-upload-archive.html197760644editdlrm
git-upload-archive.txt20870644editdlrm
git-upload-pack.html216710644editdlrm
git-upload-pack.txt29980644editdlrm
git-var.html215370644editdlrm
git-var.txt31760644editdlrm
git-verify-commit.html179480644editdlrm
git-verify-commit.txt5750644editdlrm
git-verify-pack.html189530644editdlrm
git-verify-pack.txt11110644editdlrm
git-verify-tag.html179410644editdlrm
git-verify-tag.txt5620644editdlrm
git-version.html177980644editdlrm
git-version.txt5320644editdlrm
git-web--browse.html224050644editdlrm
git-web--browse.txt35760644editdlrm
git-whatchanged.html185720644editdlrm
git-whatchanged.txt10980644editdlrm
git-worktree.html463410644editdlrm
git-worktree.txt209850644editdlrm
git-write-tree.html184410644editdlrm
git-write-tree.txt10260644editdlrm
git.html1072370644editdlrm
git.txt432540644editdlrm
gitattributes.html828450644editdlrm
gitattributes.txt495110644editdlrm
gitcli.html295840644editdlrm
gitcli.txt96970644editdlrm
gitcore-tutorial.html1001390644editdlrm
gitcore-tutorial.txt622400644editdlrm
gitcredentials.html319800644editdlrm
gitcredentials.txt113170644editdlrm
gitdiffcore.html337450644editdlrm
gitdiffcore.txt140820644editdlrm
giteveryday.html380920644editdlrm
giteveryday.txt144220644editdlrm
gitfaq.html440810644editdlrm
gitfaq.txt210690644editdlrm
gitformat-bundle.html214460644editdlrm
gitformat-bundle.txt32560644editdlrm
gitformat-chunk.html243290644editdlrm
gitformat-chunk.txt55600644editdlrm
gitformat-commit-graph.html286300644editdlrm
gitformat-commit-graph.txt78570644editdlrm
gitformat-index.html402690644editdlrm
gitformat-index.txt151800644editdlrm
gitformat-pack.html498110644editdlrm
gitformat-pack.txt235090644editdlrm
gitformat-signature.html273620644editdlrm
gitformat-signature.txt80930644editdlrm
gitglossary.html642010644editdlrm
gitglossary.txt3580644editdlrm
githooks.html565000644editdlrm
githooks.txt293310644editdlrm
gitignore.html283990644editdlrm
gitignore.txt89180644editdlrm
gitmailmap.html228190644editdlrm
gitmailmap.txt35510644editdlrm
gitmodules.html240570644editdlrm
gitmodules.txt48000644editdlrm
gitnamespaces.html221480644editdlrm
gitnamespaces.txt25090644editdlrm
gitprotocol-capabilities.html374250644editdlrm
gitprotocol-capabilities.txt153110644editdlrm
gitprotocol-common.html215650644editdlrm
gitprotocol-common.txt31770644editdlrm
gitprotocol-http.html432340644editdlrm
gitprotocol-http.txt179940644editdlrm
gitprotocol-pack.html530230644editdlrm
gitprotocol-pack.txt276780644editdlrm
gitprotocol-v2.html596900644editdlrm
gitprotocol-v2.txt314340644editdlrm
gitremote-helpers.html482150644editdlrm
gitremote-helpers.txt217850644editdlrm
gitrepository-layout.html393520644editdlrm
gitrepository-layout.txt116220644editdlrm
gitrevisions.html416210644editdlrm
gitrevisions.txt8230644editdlrm
gitsubmodules.html316990644editdlrm
gitsubmodules.txt103660644editdlrm
gittutorial-2.html345470644editdlrm
gittutorial-2.txt147500644editdlrm
gittutorial.html462630644editdlrm
gittutorial.txt229720644editdlrm
gitworkflows.html398690644editdlrm
gitworkflows.txt174140644editdlrm
glossary-content.txt326090644editdlrm
howto-index.html229910644editdlrm
howto-index.txt40010644editdlrm
i18n.txt29400644editdlrm
line-range-format.txt11620644editdlrm
line-range-options.txt7610644editdlrm
merge-options.txt72360644editdlrm
merge-strategies.txt66100644editdlrm
mergetools-diff.txt15070644editdlrm
mergetools-merge.txt25860644editdlrm
MyFirstContribution.html905720644editdlrm
MyFirstContribution.txt545960644editdlrm
MyFirstObjectWalk.html605540644editdlrm
MyFirstObjectWalk.txt289790644editdlrm
object-format-disclaimer.txt4700644editdlrm
pretty-formats.txt156690644editdlrm
pretty-options.txt42010644editdlrm
pull-fetch-param.txt54760644editdlrm
README.md36520644editdlrm
ref-reachability-filters.txt3910644editdlrm
rerere-options.txt4140644editdlrm
rev-list-description.txt25310644editdlrm
rev-list-options.txt469060644editdlrm
ReviewingGuidelines.html268310644editdlrm
ReviewingGuidelines.txt81000644editdlrm
revisions.txt171090644editdlrm
scalar.html260550644editdlrm
scalar.txt60560644editdlrm
sequencer.txt4720644editdlrm
signoff-option.txt7810644editdlrm
SubmittingPatches.html556600644editdlrm
SubmittingPatches.txt301470644editdlrm
ToolsForGit.html190200644editdlrm
ToolsForGit.txt13480644editdlrm
trace2-target-values.txt5290644editdlrm
transfer-data-leaks.txt17120644editdlrm
urls-remotes.txt26420644editdlrm
urls.txt36340644editdlrm
user-manual.html2757310644editdlrm
user-manual.txt1735180644editdlrm
Edit: /usr/share/doc/git/git-merge-tree.html (33496B)
git-merge-tree(1)

SYNOPSIS

git merge-tree [--write-tree] [<options>] <branch1> <branch2>
git merge-tree [--trivial-merge] <base-tree> <branch1> <branch2> (deprecated)

DESCRIPTION

This command has a modern --write-tree mode and a deprecated --trivial-merge mode. With the exception of the DEPRECATED DESCRIPTION section at the end, the rest of this documentation describes the modern --write-tree mode.

Performs a merge, but does not make any new commits and does not read from or write to either the working tree or index.

The performed merge will use the same features as the "real" git-merge(1), including:

  • three way content merges of individual files

  • rename detection

  • proper directory/file conflict handling

  • recursive ancestor consolidation (i.e. when there is more than one merge base, creating a virtual merge base by merging the merge bases)

  • etc.

After the merge completes, a new toplevel tree object is created. See OUTPUT below for details.

OPTIONS

-z

Do not quote filenames in the <Conflicted file info> 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 [OUTPUT] below for more information.

--name-only

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).

--[no-]messages

Write any informational messages such as "Auto-merging <path>" 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.

--allow-unrelated-histories

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.

--merge-base=<commit>

Instead of finding the merge-bases for <branch1> and <branch2>, specify a merge-base for the merge, and specifying multiple bases is currently not supported. This option is incompatible with --stdin.

OUTPUT

For a successful merge, the output from git-merge-tree is simply one line:

<OID of toplevel tree>

Whereas for a conflicted merge, the output is by default of the form:

<OID of toplevel tree>
<Conflicted file info>
<Informational messages>

These are discussed individually below.

However, there is an exception. If --stdin 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:

<Merge status>
<OID of toplevel tree>
<Conflicted file info>
<Informational messages>
NUL
<Merge status>
<OID of toplevel tree>
NUL

Merge status

This is an integer status followed by a NUL character. The integer status is:

0: merge had conflicts
1: merge was clean
<0: something prevented the merge from running (e.g. access to repository
    objects denied by filesystem)

OID of toplevel tree

This is a tree object that represents what would be checked out in the working tree at the end of git merge. 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 -z is passed).

Conflicted file info

This is a sequence of lines with the format

<mode> <object> <stage> <filename>

The filename will be quoted as explained for the configuration variable core.quotePath (see git-config(1)). However, if the --name-only option is passed, the mode, object, and stage will be omitted. If -z is passed, the "lines" are terminated by a NUL character instead of a newline character.

Informational messages

This section provides informational messages, typically about conflicts. The format of the section varies significantly depending on whether -z is passed.

If -z is passed:

The output format is zero or more conflict informational records, each of the form:

<list-of-paths><conflict-type>NUL<conflict-message>NUL

where <list-of-paths> is of the form

<number-of-paths>NUL<path1>NUL<path2>NUL...<pathN>NUL

and includes paths (or branch names) affected by the conflict or informational message in <conflict-message>. Also, <conflict-type> is a stable string explaining the type of conflict, such as

  • "Auto-merging"

  • "CONFLICT (rename/delete)"

  • "CONFLICT (submodule lacks merge base)"

  • "CONFLICT (binary)"

and <conflict-message> is a more detailed message about the conflict which often (but not always) embeds the <stable-short-type-description> within it. These strings may change in future Git versions. Some examples:

  • "Auto-merging <file>"

  • "CONFLICT (rename/delete): <oldfile> renamed…but deleted in…"

  • "Failed to merge submodule <submodule> (no merge base)"

  • "Warning: cannot merge binary files: <filename>"

If -z is NOT passed:

This section starts with a blank line to separate it from the previous sections, and then only contains the <conflict-message> information from the previous section (separated by newlines). These are non-stable strings that should not be parsed by scripts, and are just meant for human consumption. Also, note that while <conflict-message> strings usually do not contain embedded newlines, they sometimes do. (However, the free-form messages will never have an embedded NUL character). So, the entire block of information is meant for human readers as an agglomeration of all conflict messages.

EXIT STATUS

For a successful, non-conflicted merge, the exit status is 0. When the merge has conflicts, the exit status is 1. If the merge is not able to complete (or start) due to some kind of error, the exit status is something other than 0 or 1 (and the output is unspecified). When --stdin is passed, the return status is 0 for both successful and conflicted merges, and something other than 0 or 1 if it cannot complete all the requested merges.

USAGE NOTES

This command is intended as low-level plumbing, similar to git-hash-object(1), git-mktree(1), git-commit-tree(1), git-write-tree(1), git-update-ref(1), and git-mktag(1). Thus, it can be used as a part of a series of steps such as:

NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)
test $? -eq 0 || die "There were conflicts..."
NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)
git update-ref $BRANCH1 $NEWCOMMIT

Note that when the exit status is non-zero, NEWTREE in this sequence will contain a lot more output than just a tree.

For conflicts, the output includes the same information that you’d get with git-merge(1):

INPUT FORMAT

git merge-tree --stdin input format is fully text based. Each line has this format:

[<base-commit> -- ]<branch1> <branch2>

If one line is separated by --, the string before the separator is used for specifying a merge-base for the merge and the string after the separator describes the branches to be merged.

MISTAKES TO AVOID

Do NOT look through the resulting toplevel tree to try to find which files conflict; parse the Conflicted file info section instead. Not only would parsing an entire tree be horrendously slow in large repositories, there are numerous types of conflicts not representable by conflict markers (modify/delete, mode conflict, binary file changed on both sides, file/directory conflicts, various rename conflict permutations, etc.)

Do NOT interpret an empty Conflicted file info list as a clean merge; check the exit status. A merge can have conflicts without having individual files conflict (there are a few types of directory rename conflicts that fall into this category, and others might also be added in the future).

Do NOT attempt to guess or make the user guess the conflict types from the Conflicted file info list. The information there is insufficient to do so. For example: Rename/rename(1to2) conflicts (both sides renamed the same file differently) will result in three different files having higher order stages (but each only has one higher order stage), with no way (short of the Informational messages section) to determine which three files are related. File/directory conflicts also result in a file with exactly one higher order stage. Possibly-involved-in-directory-rename conflicts (when "merge.directoryRenames" is unset or set to "conflicts") also result in a file with exactly one higher order stage. In all cases, the Informational messages section has the necessary info, though it is not designed to be machine parseable.

Do NOT assume that each path from Conflicted file info, and the logical conflicts in the Informational messages have a one-to-one mapping, nor that there is a one-to-many mapping, nor a many-to-one mapping. Many-to-many mappings exist, meaning that each path can have many logical conflict types in a single merge, and each logical conflict type can affect many paths.

Do NOT assume all filenames listed in the Informational messages section had conflicts. Messages can be included for files that have no conflicts, such as "Auto-merging <file>".

AVOID taking the OIDS from the Conflicted file info and re-merging them to present the conflicts to the user. This will lose information. Instead, look up the version of the file found within the OID of toplevel tree and show that instead. In particular, the latter will have conflict markers annotated with the original branch/commit being merged and, if renames were involved, the original filename. While you could include the original branch/commit in the conflict marker annotations when re-merging, the original filename is not available from the Conflicted file info and thus you would be losing information that might help the user resolve the conflict.

DEPRECATED DESCRIPTION

Per the DESCRIPTION and unlike the rest of this documentation, this section describes the deprecated --trivial-merge mode.

Other than the optional --trivial-merge, this mode accepts no options.

This mode reads three tree-ish, and outputs trivial merge results and conflicting stages to the standard output in a semi-diff format. Since this was designed for higher level scripts to consume and merge the results back into the index, it omits entries that match <branch1>. The result of this second form is similar to what three-way git read-tree -m does, but instead of storing the results in the index, the command outputs the entries to the standard output.

This form not only has limited applicability (a trivial merge cannot handle content merges of individual files, rename detection, proper directory/file conflict handling, etc.), the output format is also difficult to work with, and it will generally be less performant than the first form even on successful merges (especially if working in large repositories).

GIT

Part of the git(1) suite