CINXE.COM

Git - git-merge Documentation

<!DOCTYPE html> <html lang="en"> <head> <script type="text/javascript"> const currentTheme = localStorage.getItem("theme") if (currentTheme) { const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches if ((prefersDarkScheme && currentTheme === "light") || (!prefersDarkScheme && currentTheme === "dark")) { document.documentElement.dataset.theme = currentTheme } } </script> <meta charset='utf-8'> <meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Git - git-merge Documentation</title> <link href="/favicon.ico" rel='shortcut icon' type='image/x-icon'> <link rel="stylesheet" href="/application.min.css"> </head> <body id="documentation"> <div class="inner"> <header> <a id="logo" href="/"><img src="/images/logo@2x.png" width="110" height="46" alt="Git" class="no-filter" /></a> <span id="tagline"></span> <script type="text/javascript"> const taglines = [ "fast-version-control", "everything-is-local", "distributed-even-if-your-workflow-isnt", "local-branching-on-the-cheap", "distributed-is-the-new-centralized" ]; var tagline = taglines[Math.floor(Math.random() * taglines.length)]; document.getElementById('tagline').innerHTML = '--' + tagline; </script> <div id="search-container"> <form id="search" action="/search/results"> <input id="search-text" name="search" placeholder="Type / to search entire site…" autocomplete="off" type="text" /> </form> <div id="search-results"></div> </div> <img src="/images/dark-mode.svg" id="dark-mode-button" /> </header> </div> <div class="inner"> <div id="content-wrapper"> <div tabindex="1" class="sidebar-btn"></div> <aside class="sidebar" id="sidebar"> <nav> <ul> <li> <a href="/about">About</a> <ul> </ul> </li> <li> <a href="/doc" class="active">Documentation</a> <ul class="expanded"> <li> <a href="/docs" class="active">Reference</a> </li> <li> <a href="/book">Book</a> </li> <li> <a href="/videos">Videos</a> </li> <li> <a href="/doc/ext">External Links</a> </li> </ul> </li> <li> <a href="/downloads">Downloads</a> <ul > <li> <a href="/downloads/guis">GUI Clients</a> </li> <li> <a href="/downloads/logos">Logos</a> </li> </ul> </li> <li> <a href="/community">Community</a> </li> </ul> </nav> </aside> <div id="content"> <div id='reference-version'> <a class="dropdown-trigger" id="reference-languages-trigger" data-panel-id="l10n-versions-dropdown" href="#"> English ▾</a> <div class='dropdown-panel right' id='l10n-versions-dropdown'> <header>Localized versions of <strong>git-merge</strong> manual</header> <ol class='reference-previous-versions'> <li> <a href="/docs/git-merge"><span class="version">English</span> </a> </li> <li> <a href="/docs/git-merge/fr"><span class="version">Français</span> </a> </li> <li> <a href="/docs/git-merge/pt_BR"><span class="version">Português (Brasil)</span> </a> </li> <li> <a href="/docs/git-merge/zh_HANS-CN"><span class="version">简体中文</span> </a> </li> </ol> <footer> Want to read in your language or fix typos?<br/> <a href="https://github.com/jnavila/git-manpages-l10n">You can help translate this page</a>. </footer> </div> <a class="dropdown-trigger" id="reference-topics-trigger" data-panel-id="topics-dropdown" href="#">Topics ▾</a> <div class='dropdown-panel right' id='topics-dropdown'> <div class='three-column'> <div class='column-left'> <h3 class='setup'>Setup and Config</h3> <ul class='unstyled'> <li> <a href="/docs/git"> git </a> </li> <li> <a href="/docs/git-config"> config </a> </li> <li> <a href="/docs/git-help"> help </a> </li> <li> <a href="/docs/git-bugreport"> bugreport </a> </li> <li> <a href="/doc/credential-helpers"> Credential helpers </a> </li> </ul> <h3 class='projects'>Getting and Creating Projects</h3> <ul class='unstyled'> <li> <a href="/docs/git-init"> init </a> </li> <li> <a href="/docs/git-clone"> clone </a> </li> </ul> <h3 class='snapshotting'>Basic Snapshotting</h3> <ul class='unstyled'> <li> <a href="/docs/git-add"> add </a> </li> <li> <a href="/docs/git-status"> status </a> </li> <li> <a href="/docs/git-diff"> diff </a> </li> <li> <a href="/docs/git-commit"> commit </a> </li> <li> <a href="/docs/git-notes"> notes </a> </li> <li> <a href="/docs/git-restore"> restore </a> </li> <li> <a href="/docs/git-reset"> reset </a> </li> <li> <a href="/docs/git-rm"> rm </a> </li> <li> <a href="/docs/git-mv"> mv </a> </li> </ul> <h3 class='branching'>Branching and Merging</h3> <ul class='unstyled'> <li> <a href="/docs/git-branch"> branch </a> </li> <li> <a href="/docs/git-checkout"> checkout </a> </li> <li> <a href="/docs/git-switch"> switch </a> </li> <li> <a href="/docs/git-merge"> merge </a> </li> <li> <a href="/docs/git-mergetool"> mergetool </a> </li> <li> <a href="/docs/git-log"> log </a> </li> <li> <a href="/docs/git-stash"> stash </a> </li> <li> <a href="/docs/git-tag"> tag </a> </li> <li> <a href="/docs/git-worktree"> worktree </a> </li> </ul> <h3 class='sharing'>Sharing and Updating Projects</h3> <ul class='unstyled'> <li> <a href="/docs/git-fetch"> fetch </a> </li> <li> <a href="/docs/git-pull"> pull </a> </li> <li> <a href="/docs/git-push"> push </a> </li> <li> <a href="/docs/git-remote"> remote </a> </li> <li> <a href="/docs/git-submodule"> submodule </a> </li> </ul> </div> <div class='column-middle'> <h3 class='inspection'>Inspection and Comparison</h3> <ul class='unstyled'> <li> <a href="/docs/git-show"> show </a> </li> <li> <a href="/docs/git-log"> log </a> </li> <li> <a href="/docs/git-diff"> diff </a> </li> <li> <a href="/docs/git-difftool"> difftool </a> </li> <li> <a href="/docs/git-range-diff"> range-diff </a> </li> <li> <a href="/docs/git-shortlog"> shortlog </a> </li> <li> <a href="/docs/git-describe"> describe </a> </li> </ul> <h3 class='patching'>Patching</h3> <ul class='unstyled'> <li> <a href="/docs/git-apply"> apply </a> </li> <li> <a href="/docs/git-cherry-pick"> cherry-pick </a> </li> <li> <a href="/docs/git-diff"> diff </a> </li> <li> <a href="/docs/git-rebase"> rebase </a> </li> <li> <a href="/docs/git-revert"> revert </a> </li> </ul> <h3 class='debugging'>Debugging</h3> <ul class='unstyled'> <li> <a href="/docs/git-bisect"> bisect </a> </li> <li> <a href="/docs/git-blame"> blame </a> </li> <li> <a href="/docs/git-grep"> grep </a> </li> </ul> <h3 class='email'>Email</h3> <ul class='unstyled'> <li> <a href="/docs/git-am"> am </a> </li> <li> <a href="/docs/git-apply"> apply </a> </li> <li> <a href="/docs/git-format-patch"> format-patch </a> </li> <li> <a href="/docs/git-send-email"> send-email </a> </li> <li> <a href="/docs/git-request-pull"> request-pull </a> </li> </ul> <h3 class='external'>External Systems</h3> <ul class='unstyled'> <li> <a href="/docs/git-svn"> svn </a> </li> <li> <a href="/docs/git-fast-import"> fast-import </a> </li> </ul> <h3 class='server-admin'>Server Admin</h3> <ul class='unstyled'> <li> <a href="/docs/git-daemon"> daemon </a> </li> <li> <a href="/docs/git-update-server-info"> update-server-info </a> </li> </ul> </div> <div class='column-right'> <h3 class='guides'>Guides</h3> <ul class='unstyled'> <li> <a href="/docs/gitattributes"> gitattributes </a> </li> <li> <a href="/docs/gitcli"> Command-line interface conventions </a> </li> <li> <a href="/docs/giteveryday"> Everyday Git </a> </li> <li> <a href="/docs/gitfaq"> Frequently Asked Questions (FAQ) </a> </li> <li> <a href="/docs/gitglossary"> Glossary </a> </li> <li> <a href="/docs/githooks"> Hooks </a> </li> <li> <a href="/docs/gitignore"> gitignore </a> </li> <li> <a href="/docs/gitmodules"> gitmodules </a> </li> <li> <a href="/docs/gitrevisions"> Revisions </a> </li> <li> <a href="/docs/gitsubmodules"> Submodules </a> </li> <li> <a href="/docs/gittutorial"> Tutorial </a> </li> <li> <a href="/docs/gitworkflows"> Workflows </a> </li> <li> <a href="/docs/git#_guides"> All guides... </a> </li> </ul> <h3 class='admin'>Administration</h3> <ul class='unstyled'> <li> <a href="/docs/git-clean"> clean </a> </li> <li> <a href="/docs/git-gc"> gc </a> </li> <li> <a href="/docs/git-fsck"> fsck </a> </li> <li> <a href="/docs/git-reflog"> reflog </a> </li> <li> <a href="/docs/git-filter-branch"> filter-branch </a> </li> <li> <a href="/docs/git-instaweb"> instaweb </a> </li> <li> <a href="/docs/git-archive"> archive </a> </li> <li> <a href="/docs/git-bundle"> bundle </a> </li> </ul> <h3 class='plumbing'>Plumbing Commands</h3> <ul class='unstyled'> <li> <a href="/docs/git-cat-file"> cat-file </a> </li> <li> <a href="/docs/git-check-ignore"> check-ignore </a> </li> <li> <a href="/docs/git-checkout-index"> checkout-index </a> </li> <li> <a href="/docs/git-commit-tree"> commit-tree </a> </li> <li> <a href="/docs/git-count-objects"> count-objects </a> </li> <li> <a href="/docs/git-diff-index"> diff-index </a> </li> <li> <a href="/docs/git-for-each-ref"> for-each-ref </a> </li> <li> <a href="/docs/git-hash-object"> hash-object </a> </li> <li> <a href="/docs/git-ls-files"> ls-files </a> </li> <li> <a href="/docs/git-ls-tree"> ls-tree </a> </li> <li> <a href="/docs/git-merge-base"> merge-base </a> </li> <li> <a href="/docs/git-read-tree"> read-tree </a> </li> <li> <a href="/docs/git-rev-list"> rev-list </a> </li> <li> <a href="/docs/git-rev-parse"> rev-parse </a> </li> <li> <a href="/docs/git-show-ref"> show-ref </a> </li> <li> <a href="/docs/git-symbolic-ref"> symbolic-ref </a> </li> <li> <a href="/docs/git-update-index"> update-index </a> </li> <li> <a href="/docs/git-update-ref"> update-ref </a> </li> <li> <a href="/docs/git-verify-pack"> verify-pack </a> </li> <li> <a href="/docs/git-write-tree"> write-tree </a> </li> </ul> </div> </div> </div> <a class="dropdown-trigger" id="reference-versions-trigger" data-panel-id="previous-versions-dropdown" href="#"> Version 2.33.1 ▾ </a> <span class="light d-flex">git-merge last updated in 2.49.0</span> <div class='dropdown-panel left' id='previous-versions-dropdown'> <header>Changes in the <strong>git-merge</strong> manual</header> <ol class='reference-previous-versions'> <li> <a href="/docs/git-merge/2.49.0"><span class="version">2.49.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2025-03-14</em> </a> </li> <li class="no-change"><span>2.48.1 no changes</span></li> <li class="no-change"><span>2.48.0 no changes</span></li> <li class="no-change"><span>2.47.1 &rarr; 2.47.2 no changes</span></li> <li> <a href="/docs/git-merge/2.47.0"><span class="version">2.47.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2024-10-06</em> </a> </li> <li class="no-change"><span>2.43.2 &rarr; 2.46.3 no changes</span></li> <li> <a href="/docs/git-merge/2.43.1"><span class="version">2.43.1</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2024-02-09</em> </a> </li> <li> <a href="/docs/git-merge/2.43.0"><span class="version">2.43.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2023-11-20</em> </a> </li> <li class="no-change"><span>2.42.1 &rarr; 2.42.4 no changes</span></li> <li> <a href="/docs/git-merge/2.42.0"><span class="version">2.42.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2023-08-21</em> </a> </li> <li class="no-change"><span>2.39.4 &rarr; 2.41.3 no changes</span></li> <li> <a href="/docs/git-merge/2.39.3"><span class="version">2.39.3</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2023-04-17</em> </a> </li> <li class="no-change"><span>2.38.1 &rarr; 2.39.2 no changes</span></li> <li> <a href="/docs/git-merge/2.38.0"><span class="version">2.38.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2022-10-02</em> </a> </li> <li class="no-change"><span>2.35.1 &rarr; 2.37.7 no changes</span></li> <li> <a href="/docs/git-merge/2.35.0"><span class="version">2.35.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2022-01-24</em> </a> </li> <li class="no-change"><span>2.34.1 &rarr; 2.34.8 no changes</span></li> <li> <a href="/docs/git-merge/2.34.0"><span class="version">2.34.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2021-11-15</em> </a> </li> <li class="no-change"><span>2.33.2 &rarr; 2.33.8 no changes</span></li> <li> <a href="/docs/git-merge/2.33.1"><span class="version">2.33.1</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2021-10-12</em> </a> </li> <li> <a href="/docs/git-merge/2.33.0"><span class="version">2.33.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2021-08-16</em> </a> </li> <li class="no-change"><span>2.30.1 &rarr; 2.32.7 no changes</span></li> <li> <a href="/docs/git-merge/2.30.0"><span class="version">2.30.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2020-12-27</em> </a> </li> <li class="no-change"><span>2.29.1 &rarr; 2.29.3 no changes</span></li> <li> <a href="/docs/git-merge/2.29.0"><span class="version">2.29.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2020-10-19</em> </a> </li> <li class="no-change"><span>2.27.1 &rarr; 2.28.1 no changes</span></li> <li> <a href="/docs/git-merge/2.27.0"><span class="version">2.27.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2020-06-01</em> </a> </li> <li class="no-change"><span>2.25.1 &rarr; 2.26.3 no changes</span></li> <li> <a href="/docs/git-merge/2.25.0"><span class="version">2.25.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2020-01-13</em> </a> </li> <li class="no-change"><span>2.24.1 &rarr; 2.24.4 no changes</span></li> <li> <a href="/docs/git-merge/2.24.0"><span class="version">2.24.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2019-11-04</em> </a> </li> <li class="no-change"><span>2.23.1 &rarr; 2.23.4 no changes</span></li> <li> <a href="/docs/git-merge/2.23.0"><span class="version">2.23.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2019-08-16</em> </a> </li> <li class="no-change"><span>2.22.2 &rarr; 2.22.5 no changes</span></li> <li> <a href="/docs/git-merge/2.22.1"><span class="version">2.22.1</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2019-08-11</em> </a> </li> <li> <a href="/docs/git-merge/2.22.0"><span class="version">2.22.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2019-06-07</em> </a> </li> <li class="no-change"><span>2.20.1 &rarr; 2.21.4 no changes</span></li> <li> <a href="/docs/git-merge/2.20.0"><span class="version">2.20.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2018-12-09</em> </a> </li> <li class="no-change"><span>2.19.1 &rarr; 2.19.6 no changes</span></li> <li> <a href="/docs/git-merge/2.19.0"><span class="version">2.19.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2018-09-10</em> </a> </li> <li class="no-change"><span>2.18.1 &rarr; 2.18.5 no changes</span></li> <li> <a href="/docs/git-merge/2.18.0"><span class="version">2.18.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2018-06-21</em> </a> </li> <li class="no-change"><span>2.17.1 &rarr; 2.17.6 no changes</span></li> <li> <a href="/docs/git-merge/2.17.0"><span class="version">2.17.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2018-04-02</em> </a> </li> <li> <a href="/docs/git-merge/2.16.6"><span class="version">2.16.6</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2019-12-06</em> </a> </li> <li> <a href="/docs/git-merge/2.15.4"><span class="version">2.15.4</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2019-12-06</em> </a> </li> <li> <a href="/docs/git-merge/2.14.6"><span class="version">2.14.6</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2019-12-06</em> </a> </li> <li> <a href="/docs/git-merge/2.13.7"><span class="version">2.13.7</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2018-05-22</em> </a> </li> <li> <a href="/docs/git-merge/2.12.5"><span class="version">2.12.5</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2017-09-22</em> </a> </li> <li class="no-change"><span>2.10.5 &rarr; 2.11.4 no changes</span></li> <li> <a href="/docs/git-merge/2.9.5"><span class="version">2.9.5</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2017-07-30</em> </a> </li> <li> <a href="/docs/git-merge/2.8.6"><span class="version">2.8.6</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2017-07-30</em> </a> </li> <li class="no-change"><span>2.7.6 no changes</span></li> <li> <a href="/docs/git-merge/2.6.7"><span class="version">2.6.7</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2017-05-05</em> </a> </li> <li> <a href="/docs/git-merge/2.5.6"><span class="version">2.5.6</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2017-05-05</em> </a> </li> <li> <a href="/docs/git-merge/2.4.12"><span class="version">2.4.12</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2017-05-05</em> </a> </li> <li class="no-change"><span>2.3.10 no changes</span></li> <li> <a href="/docs/git-merge/2.2.3"><span class="version">2.2.3</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2015-09-04</em> </a> </li> <li> <a href="/docs/git-merge/2.1.4"><span class="version">2.1.4</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2014-12-17</em> </a> </li> <li> <a href="/docs/git-merge/2.0.5"><span class="version">2.0.5</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2014-12-17</em> </a> </li> <li>&nbsp;</li> </ol> <footer> <p>Check your version of git by running</p> <code class="command">git --version</code> </footer> </div> </div> <div id="main"> <div class="sect1"> <h2 id="_name"><a class="anchor" href="#_name"></a>NAME</h2> <div class="sectionbody"> <div class="paragraph"> <p>git-merge - Join two or more development histories together</p> </div> </div> </div> <div class="sect1"> <h2 id="_synopsis"><a class="anchor" href="#_synopsis"></a>SYNOPSIS</h2> <div class="sectionbody"> <div class="verseblock"> <pre class="content"><em>git merge</em> [-n] [--stat] [--no-commit] [--squash] [--[no-]edit] [--no-verify] [-s &lt;strategy&gt;] [-X &lt;strategy-option&gt;] [-S[&lt;keyid&gt;]] [--[no-]allow-unrelated-histories] [--[no-]rerere-autoupdate] [-m &lt;msg&gt;] [-F &lt;file&gt;] [&lt;commit&gt;&#8230;&#8203;] <em>git merge</em> (--continue | --abort | --quit)</pre> </div> </div> </div> <div class="sect1"> <h2 id="_description"><a class="anchor" href="#_description"></a>DESCRIPTION</h2> <div class="sectionbody"> <div class="paragraph"> <p>Incorporates changes from the named commits (since the time their histories diverged from the current branch) into the current branch. This command is used by <em>git pull</em> to incorporate changes from another repository and can be used by hand to merge changes from one branch into another.</p> </div> <div class="paragraph"> <p>Assume the following history exists and the current branch is "<code>master</code>":</p> </div> <div class="listingblock"> <div class="content"> <pre> A---B---C topic / D---E---F---G master</pre> </div> </div> <div class="paragraph"> <p>Then "<code>git merge topic</code>" will replay the changes made on the <code>topic</code> branch since it diverged from <code>master</code> (i.e., <code>E</code>) until its current commit (<code>C</code>) on top of <code>master</code>, and record the result in a new commit along with the names of the two parent commits and a log message from the user describing the changes.</p> </div> <div class="listingblock"> <div class="content"> <pre> A---B---C topic / \ D---E---F---G---H master</pre> </div> </div> <div class="paragraph"> <p>The second syntax ("<code>git merge --abort</code>") can only be run after the merge has resulted in conflicts. <em>git merge --abort</em> will abort the merge process and try to reconstruct the pre-merge state. However, if there were uncommitted changes when the merge started (and especially if those changes were further modified after the merge was started), <em>git merge --abort</em> will in some cases be unable to reconstruct the original (pre-merge) changes. Therefore:</p> </div> <div class="paragraph"> <p><strong>Warning</strong>: Running <em>git merge</em> with non-trivial uncommitted changes is discouraged: while possible, it may leave you in a state that is hard to back out of in the case of a conflict.</p> </div> <div class="paragraph"> <p>The third syntax ("<code>git merge --continue</code>") can only be run after the merge has resulted in conflicts.</p> </div> </div> </div> <div class="sect1"> <h2 id="_options"><a class="anchor" href="#_options"></a>OPTIONS</h2> <div class="sectionbody"> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-merge.txt---commit"> <a class="anchor" href="#Documentation/git-merge.txt---commit"></a>--commit </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-commit"> <a class="anchor" href="#Documentation/git-merge.txt---no-commit"></a>--no-commit </dt> <dd> <p>Perform the merge and commit the result. This option can be used to override --no-commit.</p> <div class="paragraph"> <p>With --no-commit perform the merge and stop just before creating a merge commit, to give the user a chance to inspect and further tweak the merge result before committing.</p> </div> <div class="paragraph"> <p>Note that fast-forward updates do not create a merge commit and therefore there is no way to stop those merges with --no-commit. Thus, if you want to ensure your branch is not changed or updated by the merge command, use --no-ff with --no-commit.</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---edit"> <a class="anchor" href="#Documentation/git-merge.txt---edit"></a>--edit </dt> <dt class="hdlist1" id="Documentation/git-merge.txt--e"> <a class="anchor" href="#Documentation/git-merge.txt--e"></a>-e </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-edit"> <a class="anchor" href="#Documentation/git-merge.txt---no-edit"></a>--no-edit </dt> <dd> <p> Invoke an editor before committing successful mechanical merge to further edit the auto-generated merge message, so that the user can explain and justify the merge. The <code>--no-edit</code> option can be used to accept the auto-generated message (this is generally discouraged). The <code>--edit</code> (or <code>-e</code>) option is still useful if you are giving a draft message with the <code>-m</code> option from the command line and want to edit it in the editor.</p> <div class="paragraph"> <p>Older scripts may depend on the historical behaviour of not allowing the user to edit the merge log message. They will see an editor opened when they run <code>git merge</code>. To make it easier to adjust such scripts to the updated behaviour, the environment variable <code>GIT_MERGE_AUTOEDIT</code> can be set to <code>no</code> at the beginning of them.</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---cleanupltmodegt"> <a class="anchor" href="#Documentation/git-merge.txt---cleanupltmodegt"></a>--cleanup=&lt;mode&gt; </dt> <dd> <p>This option determines how the merge message will be cleaned up before committing. See <a href='/docs/git-commit'>git-commit[1]</a> for more details. In addition, if the <em>&lt;mode&gt;</em> is given a value of <code>scissors</code>, scissors will be appended to <code>MERGE_MSG</code> before being passed on to the commit machinery in the case of a merge conflict.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---ff"> <a class="anchor" href="#Documentation/git-merge.txt---ff"></a>--ff </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-ff"> <a class="anchor" href="#Documentation/git-merge.txt---no-ff"></a>--no-ff </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---ff-only"> <a class="anchor" href="#Documentation/git-merge.txt---ff-only"></a>--ff-only </dt> <dd> <p>Specifies how a merge is handled when the merged-in history is already a descendant of the current history. <code>--ff</code> is the default unless merging an annotated (and possibly signed) tag that is not stored in its natural place in the <code>refs/tags/</code> hierarchy, in which case <code>--no-ff</code> is assumed.</p> <div class="paragraph"> <p>With <code>--ff</code>, when possible resolve the merge as a fast-forward (only update the branch pointer to match the merged branch; do not create a merge commit). When not possible (when the merged-in history is not a descendant of the current history), create a merge commit.</p> </div> <div class="paragraph"> <p>With <code>--no-ff</code>, create a merge commit in all cases, even when the merge could instead be resolved as a fast-forward.</p> </div> <div class="paragraph"> <p>With <code>--ff-only</code>, resolve the merge as a fast-forward when possible. When not possible, refuse to merge and exit with a non-zero status.</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt--Sltkeyidgt"> <a class="anchor" href="#Documentation/git-merge.txt--Sltkeyidgt"></a>-S[&lt;keyid&gt;] </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---gpg-signltkeyidgt"> <a class="anchor" href="#Documentation/git-merge.txt---gpg-signltkeyidgt"></a>--gpg-sign[=&lt;keyid&gt;] </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-gpg-sign"> <a class="anchor" href="#Documentation/git-merge.txt---no-gpg-sign"></a>--no-gpg-sign </dt> <dd> <p>GPG-sign the resulting merge commit. The <code>keyid</code> argument is optional and defaults to the committer identity; if specified, it must be stuck to the option without a space. <code>--no-gpg-sign</code> is useful to countermand both <code>commit.gpgSign</code> configuration variable, and earlier <code>--gpg-sign</code>.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---logltngt"> <a class="anchor" href="#Documentation/git-merge.txt---logltngt"></a>--log[=&lt;n&gt;] </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-log"> <a class="anchor" href="#Documentation/git-merge.txt---no-log"></a>--no-log </dt> <dd> <p>In addition to branch names, populate the log message with one-line descriptions from at most &lt;n&gt; actual commits that are being merged. See also <a href='/docs/git-fmt-merge-msg'>git-fmt-merge-msg[1]</a>.</p> <div class="paragraph"> <p>With --no-log do not list one-line descriptions from the actual commits being merged.</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---signoff"> <a class="anchor" href="#Documentation/git-merge.txt---signoff"></a>--signoff </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-signoff"> <a class="anchor" href="#Documentation/git-merge.txt---no-signoff"></a>--no-signoff </dt> <dd> <p>Add a <code>Signed-off-by</code> trailer by the committer at the end of the commit log message. The meaning of a signoff depends on the project to which you&#8217;re committing. For example, it may certify that the committer has the rights to submit the work under the project&#8217;s license or agrees to some contributor representation, such as a Developer Certificate of Origin. (See <a href="http://developercertificate.org" class="bare">http://developercertificate.org</a> for the one used by the Linux kernel and Git projects.) Consult the documentation or leadership of the project to which you&#8217;re contributing to understand how the signoffs are used in that project.</p> <div class="paragraph"> <p>The --no-signoff option can be used to countermand an earlier --signoff option on the command line.</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---stat"> <a class="anchor" href="#Documentation/git-merge.txt---stat"></a>--stat </dt> <dt class="hdlist1" id="Documentation/git-merge.txt--n"> <a class="anchor" href="#Documentation/git-merge.txt--n"></a>-n </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-stat"> <a class="anchor" href="#Documentation/git-merge.txt---no-stat"></a>--no-stat </dt> <dd> <p>Show a diffstat at the end of the merge. The diffstat is also controlled by the configuration option merge.stat.</p> <div class="paragraph"> <p>With -n or --no-stat do not show a diffstat at the end of the merge.</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---squash"> <a class="anchor" href="#Documentation/git-merge.txt---squash"></a>--squash </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-squash"> <a class="anchor" href="#Documentation/git-merge.txt---no-squash"></a>--no-squash </dt> <dd> <p>Produce the working tree and index state as if a real merge happened (except for the merge information), but do not actually make a commit, move the <code>HEAD</code>, or record <code>$GIT_DIR/MERGE_HEAD</code> (to cause the next <code>git commit</code> command to create a merge commit). This allows you to create a single commit on top of the current branch whose effect is the same as merging another branch (or more in case of an octopus).</p> <div class="paragraph"> <p>With --no-squash perform the merge and commit the result. This option can be used to override --squash.</p> </div> <div class="paragraph"> <p>With --squash, --commit is not allowed, and will fail.</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---no-verify"> <a class="anchor" href="#Documentation/git-merge.txt---no-verify"></a>--no-verify </dt> <dd> <p>This option bypasses the pre-merge and commit-msg hooks. See also <a href='/docs/githooks'>githooks[5]</a>.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt--sltstrategygt"> <a class="anchor" href="#Documentation/git-merge.txt--sltstrategygt"></a>-s &lt;strategy&gt; </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---strategyltstrategygt"> <a class="anchor" href="#Documentation/git-merge.txt---strategyltstrategygt"></a>--strategy=&lt;strategy&gt; </dt> <dd> <p>Use the given merge strategy; can be supplied more than once to specify them in the order they should be tried. If there is no <code>-s</code> option, a built-in list of strategies is used instead (<code>recursive</code> when merging a single head, <code>octopus</code> otherwise).</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt--Xltoptiongt"> <a class="anchor" href="#Documentation/git-merge.txt--Xltoptiongt"></a>-X &lt;option&gt; </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---strategy-optionltoptiongt"> <a class="anchor" href="#Documentation/git-merge.txt---strategy-optionltoptiongt"></a>--strategy-option=&lt;option&gt; </dt> <dd> <p>Pass merge strategy specific option through to the merge strategy.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---verify-signatures"> <a class="anchor" href="#Documentation/git-merge.txt---verify-signatures"></a>--verify-signatures </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-verify-signatures"> <a class="anchor" href="#Documentation/git-merge.txt---no-verify-signatures"></a>--no-verify-signatures </dt> <dd> <p>Verify that the tip commit of the side branch being merged is signed with a valid key, i.e. a key that has a valid uid: in the default trust model, this means the signing key has been signed by a trusted key. If the tip commit of the side branch is not signed with a valid key, the merge is aborted.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---summary"> <a class="anchor" href="#Documentation/git-merge.txt---summary"></a>--summary </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-summary"> <a class="anchor" href="#Documentation/git-merge.txt---no-summary"></a>--no-summary </dt> <dd> <p>Synonyms to --stat and --no-stat; these are deprecated and will be removed in the future.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt--q"> <a class="anchor" href="#Documentation/git-merge.txt--q"></a>-q </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---quiet"> <a class="anchor" href="#Documentation/git-merge.txt---quiet"></a>--quiet </dt> <dd> <p>Operate quietly. Implies --no-progress.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt--v"> <a class="anchor" href="#Documentation/git-merge.txt--v"></a>-v </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---verbose"> <a class="anchor" href="#Documentation/git-merge.txt---verbose"></a>--verbose </dt> <dd> <p>Be verbose.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---progress"> <a class="anchor" href="#Documentation/git-merge.txt---progress"></a>--progress </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-progress"> <a class="anchor" href="#Documentation/git-merge.txt---no-progress"></a>--no-progress </dt> <dd> <p>Turn progress on/off explicitly. If neither is specified, progress is shown if standard error is connected to a terminal. Note that not all merge strategies may support progress reporting.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---autostash"> <a class="anchor" href="#Documentation/git-merge.txt---autostash"></a>--autostash </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-autostash"> <a class="anchor" href="#Documentation/git-merge.txt---no-autostash"></a>--no-autostash </dt> <dd> <p>Automatically create a temporary stash entry before the operation begins, record it in the special ref <code>MERGE_AUTOSTASH</code> and apply it after the operation ends. This means that you can run the operation on a dirty worktree. However, use with care: the final stash application after a successful merge might result in non-trivial conflicts.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---allow-unrelated-histories"> <a class="anchor" href="#Documentation/git-merge.txt---allow-unrelated-histories"></a>--allow-unrelated-histories </dt> <dd> <p>By default, <code>git merge</code> command refuses to merge histories that do not share a common ancestor. This option can be used to override this safety when merging histories of two projects that started their lives independently. As that is a very rare occasion, no configuration variable to enable this by default exists and will not be added.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt--mltmsggt"> <a class="anchor" href="#Documentation/git-merge.txt--mltmsggt"></a>-m &lt;msg&gt; </dt> <dd> <p>Set the commit message to be used for the merge commit (in case one is created).</p> <div class="paragraph"> <p>If <code>--log</code> is specified, a shortlog of the commits being merged will be appended to the specified message.</p> </div> <div class="paragraph"> <p>The <em>git fmt-merge-msg</em> command can be used to give a good default for automated <em>git merge</em> invocations. The automated message can include the branch description.</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt--Fltfilegt"> <a class="anchor" href="#Documentation/git-merge.txt--Fltfilegt"></a>-F &lt;file&gt; </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---fileltfilegt"> <a class="anchor" href="#Documentation/git-merge.txt---fileltfilegt"></a>--file=&lt;file&gt; </dt> <dd> <p>Read the commit message to be used for the merge commit (in case one is created).</p> <div class="paragraph"> <p>If <code>--log</code> is specified, a shortlog of the commits being merged will be appended to the specified message.</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---rerere-autoupdate"> <a class="anchor" href="#Documentation/git-merge.txt---rerere-autoupdate"></a>--rerere-autoupdate </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-rerere-autoupdate"> <a class="anchor" href="#Documentation/git-merge.txt---no-rerere-autoupdate"></a>--no-rerere-autoupdate </dt> <dd> <p>Allow the rerere mechanism to update the index with the result of auto-conflict resolution if possible.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---overwrite-ignore"> <a class="anchor" href="#Documentation/git-merge.txt---overwrite-ignore"></a>--overwrite-ignore </dt> <dt class="hdlist1" id="Documentation/git-merge.txt---no-overwrite-ignore"> <a class="anchor" href="#Documentation/git-merge.txt---no-overwrite-ignore"></a>--no-overwrite-ignore </dt> <dd> <p>Silently overwrite ignored files from the merge result. This is the default behavior. Use <code>--no-overwrite-ignore</code> to abort.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---abort"> <a class="anchor" href="#Documentation/git-merge.txt---abort"></a>--abort </dt> <dd> <p>Abort the current conflict resolution process, and try to reconstruct the pre-merge state. If an autostash entry is present, apply it to the worktree.</p> <div class="paragraph"> <p>If there were uncommitted worktree changes present when the merge started, <em>git merge --abort</em> will in some cases be unable to reconstruct these changes. It is therefore recommended to always commit or stash your changes before running <em>git merge</em>.</p> </div> <div class="paragraph"> <p><em>git merge --abort</em> is equivalent to <em>git reset --merge</em> when <code>MERGE_HEAD</code> is present unless <code>MERGE_AUTOSTASH</code> is also present in which case <em>git merge --abort</em> applies the stash entry to the worktree whereas <em>git reset --merge</em> will save the stashed changes in the stash list.</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---quit"> <a class="anchor" href="#Documentation/git-merge.txt---quit"></a>--quit </dt> <dd> <p>Forget about the current merge in progress. Leave the index and the working tree as-is. If <code>MERGE_AUTOSTASH</code> is present, the stash entry will be saved to the stash list.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt---continue"> <a class="anchor" href="#Documentation/git-merge.txt---continue"></a>--continue </dt> <dd> <p>After a <em>git merge</em> stops due to conflicts you can conclude the merge by running <em>git merge --continue</em> (see "HOW TO RESOLVE CONFLICTS" section below).</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-ltcommitgt82308203"> <a class="anchor" href="#Documentation/git-merge.txt-ltcommitgt82308203"></a>&lt;commit&gt;&#8230;&#8203; </dt> <dd> <p>Commits, usually other branch heads, to merge into our branch. Specifying more than one commit will create a merge with more than two parents (affectionately called an Octopus merge).</p> <div class="paragraph"> <p>If no commit is given from the command line, merge the remote-tracking branches that the current branch is configured to use as its upstream. See also the configuration section of this manual page.</p> </div> <div class="paragraph"> <p>When <code>FETCH_HEAD</code> (and no other commit) is specified, the branches recorded in the <code>.git/FETCH_HEAD</code> file by the previous invocation of <code>git fetch</code> for merging are merged to the current branch.</p> </div> </dd> </dl> </div> </div> </div> <div class="sect1"> <h2 id="_pre_merge_checks"><a class="anchor" href="#_pre_merge_checks"></a>PRE-MERGE CHECKS</h2> <div class="sectionbody"> <div class="paragraph"> <p>Before applying outside changes, you should get your own work in good shape and committed locally, so it will not be clobbered if there are conflicts. See also <a href='/docs/git-stash'>git-stash[1]</a>. <em>git pull</em> and <em>git merge</em> will stop without doing anything when local uncommitted changes overlap with files that <em>git pull</em>/<em>git merge</em> may need to update.</p> </div> <div class="paragraph"> <p>To avoid recording unrelated changes in the merge commit, <em>git pull</em> and <em>git merge</em> will also abort if there are any changes registered in the index relative to the <code>HEAD</code> commit. (Special narrow exceptions to this rule may exist depending on which merge strategy is in use, but generally, the index must match HEAD.)</p> </div> <div class="paragraph"> <p>If all named commits are already ancestors of <code>HEAD</code>, <em>git merge</em> will exit early with the message "Already up to date."</p> </div> </div> </div> <div class="sect1"> <h2 id="_fast_forward_merge"><a class="anchor" href="#_fast_forward_merge"></a>FAST-FORWARD MERGE</h2> <div class="sectionbody"> <div class="paragraph"> <p>Often the current branch head is an ancestor of the named commit. This is the most common case especially when invoked from <em>git pull</em>: you are tracking an upstream repository, you have committed no local changes, and now you want to update to a newer upstream revision. In this case, a new commit is not needed to store the combined history; instead, the <code>HEAD</code> (along with the index) is updated to point at the named commit, without creating an extra merge commit.</p> </div> <div class="paragraph"> <p>This behavior can be suppressed with the <code>--no-ff</code> option.</p> </div> </div> </div> <div class="sect1"> <h2 id="_true_merge"><a class="anchor" href="#_true_merge"></a>TRUE MERGE</h2> <div class="sectionbody"> <div class="paragraph"> <p>Except in a fast-forward merge (see above), the branches to be merged must be tied together by a merge commit that has both of them as its parents.</p> </div> <div class="paragraph"> <p>A merged version reconciling the changes from all branches to be merged is committed, and your <code>HEAD</code>, index, and working tree are updated to it. It is possible to have modifications in the working tree as long as they do not overlap; the update will preserve them.</p> </div> <div class="paragraph"> <p>When it is not obvious how to reconcile the changes, the following happens:</p> </div> <div class="olist arabic"> <ol class="arabic"> <li> <p>The <code>HEAD</code> pointer stays the same.</p> </li> <li> <p>The <code>MERGE_HEAD</code> ref is set to point to the other branch head.</p> </li> <li> <p>Paths that merged cleanly are updated both in the index file and in your working tree.</p> </li> <li> <p>For conflicting paths, the index file records up to three versions: stage 1 stores the version from the common ancestor, stage 2 from <code>HEAD</code>, and stage 3 from <code>MERGE_HEAD</code> (you can inspect the stages with <code>git ls-files -u</code>). The working tree files contain the result of the "merge" program; i.e. 3-way merge results with familiar conflict markers <code>&lt;&lt;&lt;</code> <code>===</code> <code>&gt;&gt;&gt;</code>.</p> </li> <li> <p>No other changes are made. In particular, the local modifications you had before you started merge will stay the same and the index entries for them stay as they were, i.e. matching <code>HEAD</code>.</p> </li> </ol> </div> <div class="paragraph"> <p>If you tried a merge which resulted in complex conflicts and want to start over, you can recover with <code>git merge --abort</code>.</p> </div> </div> </div> <div class="sect1"> <h2 id="_merging_tag"><a class="anchor" href="#_merging_tag"></a>MERGING TAG</h2> <div class="sectionbody"> <div class="paragraph"> <p>When merging an annotated (and possibly signed) tag, Git always creates a merge commit even if a fast-forward merge is possible, and the commit message template is prepared with the tag message. Additionally, if the tag is signed, the signature check is reported as a comment in the message template. See also <a href='/docs/git-tag'>git-tag[1]</a>.</p> </div> <div class="paragraph"> <p>When you want to just integrate with the work leading to the commit that happens to be tagged, e.g. synchronizing with an upstream release point, you may not want to make an unnecessary merge commit.</p> </div> <div class="paragraph"> <p>In such a case, you can "unwrap" the tag yourself before feeding it to <code>git merge</code>, or pass <code>--ff-only</code> when you do not have any work on your own. e.g.</p> </div> <div class="listingblock"> <div class="content"> <pre>git fetch origin git merge v1.2.3^0 git merge --ff-only v1.2.3</pre> </div> </div> </div> </div> <div class="sect1"> <h2 id="_how_conflicts_are_presented"><a class="anchor" href="#_how_conflicts_are_presented"></a>HOW CONFLICTS ARE PRESENTED</h2> <div class="sectionbody"> <div class="paragraph"> <p>During a merge, the working tree files are updated to reflect the result of the merge. Among the changes made to the common ancestor&#8217;s version, non-overlapping ones (that is, you changed an area of the file while the other side left that area intact, or vice versa) are incorporated in the final result verbatim. When both sides made changes to the same area, however, Git cannot randomly pick one side over the other, and asks you to resolve it by leaving what both sides did to that area.</p> </div> <div class="paragraph"> <p>By default, Git uses the same style as the one used by the "merge" program from the RCS suite to present such a conflicted hunk, like this:</p> </div> <div class="listingblock"> <div class="content"> <pre>Here are lines that are either unchanged from the common ancestor, or cleanly resolved because only one side changed. &lt;&lt;&lt;&lt;&lt;&lt;&lt; yours:sample.txt Conflict resolution is hard; let's go shopping. ======= Git makes conflict resolution easy. &gt;&gt;&gt;&gt;&gt;&gt;&gt; theirs:sample.txt And here is another line that is cleanly resolved or unmodified.</pre> </div> </div> <div class="paragraph"> <p>The area where a pair of conflicting changes happened is marked with markers <code>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</code>, <code>=======</code>, and <code>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</code>. The part before the <code>=======</code> is typically your side, and the part afterwards is typically their side.</p> </div> <div class="paragraph"> <p>The default format does not show what the original said in the conflicting area. You cannot tell how many lines are deleted and replaced with Barbie&#8217;s remark on your side. The only thing you can tell is that your side wants to say it is hard and you&#8217;d prefer to go shopping, while the other side wants to claim it is easy.</p> </div> <div class="paragraph"> <p>An alternative style can be used by setting the "merge.conflictStyle" configuration variable to "diff3". In "diff3" style, the above conflict may look like this:</p> </div> <div class="listingblock"> <div class="content"> <pre>Here are lines that are either unchanged from the common ancestor, or cleanly resolved because only one side changed. &lt;&lt;&lt;&lt;&lt;&lt;&lt; yours:sample.txt Conflict resolution is hard; let's go shopping. ||||||| Conflict resolution is hard. ======= Git makes conflict resolution easy. &gt;&gt;&gt;&gt;&gt;&gt;&gt; theirs:sample.txt And here is another line that is cleanly resolved or unmodified.</pre> </div> </div> <div class="paragraph"> <p>In addition to the <code>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</code>, <code>=======</code>, and <code>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</code> markers, it uses another <code>|||||||</code> marker that is followed by the original text. You can tell that the original just stated a fact, and your side simply gave in to that statement and gave up, while the other side tried to have a more positive attitude. You can sometimes come up with a better resolution by viewing the original.</p> </div> </div> </div> <div class="sect1"> <h2 id="_how_to_resolve_conflicts"><a class="anchor" href="#_how_to_resolve_conflicts"></a>HOW TO RESOLVE CONFLICTS</h2> <div class="sectionbody"> <div class="paragraph"> <p>After seeing a conflict, you can do two things:</p> </div> <div class="ulist"> <ul> <li> <p>Decide not to merge. The only clean-ups you need are to reset the index file to the <code>HEAD</code> commit to reverse 2. and to clean up working tree changes made by 2. and 3.; <code>git merge --abort</code> can be used for this.</p> </li> <li> <p>Resolve the conflicts. Git will mark the conflicts in the working tree. Edit the files into shape and <em>git add</em> them to the index. Use <em>git commit</em> or <em>git merge --continue</em> to seal the deal. The latter command checks whether there is a (interrupted) merge in progress before calling <em>git commit</em>.</p> </li> </ul> </div> <div class="paragraph"> <p>You can work through the conflict with a number of tools:</p> </div> <div class="ulist"> <ul> <li> <p>Use a mergetool. <code>git mergetool</code> to launch a graphical mergetool which will work you through the merge.</p> </li> <li> <p>Look at the diffs. <code>git diff</code> will show a three-way diff, highlighting changes from both the <code>HEAD</code> and <code>MERGE_HEAD</code> versions.</p> </li> <li> <p>Look at the diffs from each branch. <code>git log --merge -p &lt;path&gt;</code> will show diffs first for the <code>HEAD</code> version and then the <code>MERGE_HEAD</code> version.</p> </li> <li> <p>Look at the originals. <code>git show :1:filename</code> shows the common ancestor, <code>git show :2:filename</code> shows the <code>HEAD</code> version, and <code>git show :3:filename</code> shows the <code>MERGE_HEAD</code> version.</p> </li> </ul> </div> </div> </div> <div class="sect1"> <h2 id="_examples"><a class="anchor" href="#_examples"></a>EXAMPLES</h2> <div class="sectionbody"> <div class="ulist"> <ul> <li> <p>Merge branches <code>fixes</code> and <code>enhancements</code> on top of the current branch, making an octopus merge:</p> <div class="listingblock"> <div class="content"> <pre>$ git merge fixes enhancements</pre> </div> </div> </li> <li> <p>Merge branch <code>obsolete</code> into the current branch, using <code>ours</code> merge strategy:</p> <div class="listingblock"> <div class="content"> <pre>$ git merge -s ours obsolete</pre> </div> </div> </li> <li> <p>Merge branch <code>maint</code> into the current branch, but do not make a new commit automatically:</p> <div class="listingblock"> <div class="content"> <pre>$ git merge --no-commit maint</pre> </div> </div> <div class="paragraph"> <p>This can be used when you want to include further changes to the merge, or want to write your own merge commit message.</p> </div> <div class="paragraph"> <p>You should refrain from abusing this option to sneak substantial changes into a merge commit. Small fixups like bumping release/version name would be acceptable.</p> </div> </li> </ul> </div> </div> </div> <div class="sect1"> <h2 id="_merge_strategies"><a class="anchor" href="#_merge_strategies"></a>MERGE STRATEGIES</h2> <div class="sectionbody"> <div class="paragraph"> <p>The merge mechanism (<code>git merge</code> and <code>git pull</code> commands) allows the backend <em>merge strategies</em> to be chosen with <code>-s</code> option. Some strategies can also take their own options, which can be passed by giving <code>-X&lt;option&gt;</code> arguments to <code>git merge</code> and/or <code>git pull</code>.</p> </div> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-merge.txt-recursive"> <a class="anchor" href="#Documentation/git-merge.txt-recursive"></a>recursive </dt> <dd> <p>This can only resolve two heads using a 3-way merge algorithm. When there is more than one common ancestor that can be used for 3-way merge, it creates a merged tree of the common ancestors and uses that as the reference tree for the 3-way merge. This has been reported to result in fewer merge conflicts without causing mismerges by tests done on actual merge commits taken from Linux 2.6 kernel development history. Additionally this can detect and handle merges involving renames. It does not make use of detected copies. This is the default merge strategy when pulling or merging one branch.</p> <div class="paragraph"> <p>The <em>recursive</em> strategy can take the following options:</p> </div> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-merge.txt-ours"> <a class="anchor" href="#Documentation/git-merge.txt-ours"></a>ours </dt> <dd> <p>This option forces conflicting hunks to be auto-resolved cleanly by favoring <em>our</em> version. Changes from the other tree that do not conflict with our side are reflected in the merge result. For a binary file, the entire contents are taken from our side.</p> <div class="paragraph"> <p>This should not be confused with the <em>ours</em> merge strategy, which does not even look at what the other tree contains at all. It discards everything the other tree did, declaring <em>our</em> history contains all that happened in it.</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-theirs"> <a class="anchor" href="#Documentation/git-merge.txt-theirs"></a>theirs </dt> <dd> <p>This is the opposite of <em>ours</em>; note that, unlike <em>ours</em>, there is no <em>theirs</em> merge strategy to confuse this merge option with.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-patience"> <a class="anchor" href="#Documentation/git-merge.txt-patience"></a>patience </dt> <dd> <p>Deprecated synonym for <code>diff-algorithm=patience</code>.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-diff-algorithmpatienceminimalhistogrammyers"> <a class="anchor" href="#Documentation/git-merge.txt-diff-algorithmpatienceminimalhistogrammyers"></a>diff-algorithm=[patience|minimal|histogram|myers] </dt> <dd> <p>Use a different diff algorithm while merging, which can help avoid mismerges that occur due to unimportant matching lines (such as braces from distinct functions). See also <a href='/docs/git-diff'>git-diff[1]</a> <code>--diff-algorithm</code>. Defaults to the <code>diff.algorithm</code> config setting.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-ignore-space-change"> <a class="anchor" href="#Documentation/git-merge.txt-ignore-space-change"></a>ignore-space-change </dt> <dt class="hdlist1" id="Documentation/git-merge.txt-ignore-all-space"> <a class="anchor" href="#Documentation/git-merge.txt-ignore-all-space"></a>ignore-all-space </dt> <dt class="hdlist1" id="Documentation/git-merge.txt-ignore-space-at-eol"> <a class="anchor" href="#Documentation/git-merge.txt-ignore-space-at-eol"></a>ignore-space-at-eol </dt> <dt class="hdlist1" id="Documentation/git-merge.txt-ignore-cr-at-eol"> <a class="anchor" href="#Documentation/git-merge.txt-ignore-cr-at-eol"></a>ignore-cr-at-eol </dt> <dd> <p>Treats lines with the indicated type of whitespace change as unchanged for the sake of a three-way merge. Whitespace changes mixed with other changes to a line are not ignored. See also <a href='/docs/git-diff'>git-diff[1]</a> <code>-b</code>, <code>-w</code>, <code>--ignore-space-at-eol</code>, and <code>--ignore-cr-at-eol</code>.</p> <div class="ulist"> <ul> <li> <p>If <em>their</em> version only introduces whitespace changes to a line, <em>our</em> version is used;</p> </li> <li> <p>If <em>our</em> version introduces whitespace changes but <em>their</em> version includes a substantial change, <em>their</em> version is used;</p> </li> <li> <p>Otherwise, the merge proceeds in the usual way.</p> </li> </ul> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-renormalize"> <a class="anchor" href="#Documentation/git-merge.txt-renormalize"></a>renormalize </dt> <dd> <p>This runs a virtual check-out and check-in of all three stages of a file when resolving a three-way merge. This option is meant to be used when merging branches with different clean filters or end-of-line normalization rules. See "Merging branches with differing checkin/checkout attributes" in <a href='/docs/gitattributes'>gitattributes[5]</a> for details.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-no-renormalize"> <a class="anchor" href="#Documentation/git-merge.txt-no-renormalize"></a>no-renormalize </dt> <dd> <p>Disables the <code>renormalize</code> option. This overrides the <code>merge.renormalize</code> configuration variable.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-no-renames"> <a class="anchor" href="#Documentation/git-merge.txt-no-renames"></a>no-renames </dt> <dd> <p>Turn off rename detection. This overrides the <code>merge.renames</code> configuration variable. See also <a href='/docs/git-diff'>git-diff[1]</a> <code>--no-renames</code>.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-find-renamesltngt"> <a class="anchor" href="#Documentation/git-merge.txt-find-renamesltngt"></a>find-renames[=&lt;n&gt;] </dt> <dd> <p>Turn on rename detection, optionally setting the similarity threshold. This is the default. This overrides the <em>merge.renames</em> configuration variable. See also <a href='/docs/git-diff'>git-diff[1]</a> <code>--find-renames</code>.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-rename-thresholdltngt"> <a class="anchor" href="#Documentation/git-merge.txt-rename-thresholdltngt"></a>rename-threshold=&lt;n&gt; </dt> <dd> <p>Deprecated synonym for <code>find-renames=&lt;n&gt;</code>.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-subtreeltpathgt"> <a class="anchor" href="#Documentation/git-merge.txt-subtreeltpathgt"></a>subtree[=&lt;path&gt;] </dt> <dd> <p>This option is a more advanced form of <em>subtree</em> strategy, where the strategy makes a guess on how two trees must be shifted to match with each other when merging. Instead, the specified path is prefixed (or stripped from the beginning) to make the shape of two trees to match.</p> </dd> </dl> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-ort"> <a class="anchor" href="#Documentation/git-merge.txt-ort"></a>ort </dt> <dd> <p>This is meant as a drop-in replacement for the <code>recursive</code> algorithm (as reflected in its acronym&#8201;&#8212;&#8201;"Ostensibly Recursive&#8217;s Twin"), and will likely replace it in the future. It fixes corner cases that the <code>recursive</code> strategy handles suboptimally, and is significantly faster in large repositories&#8201;&#8212;&#8201;especially when many renames are involved.</p> <div class="paragraph"> <p>The <code>ort</code> strategy takes all the same options as <code>recursive</code>. However, it ignores three of those options: <code>no-renames</code>, <code>patience</code> and <code>diff-algorithm</code>. It always runs with rename detection (it handles it much faster than <code>recursive</code> does), and it specifically uses <code>diff-algorithm=histogram</code>.</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-resolve"> <a class="anchor" href="#Documentation/git-merge.txt-resolve"></a>resolve </dt> <dd> <p>This can only resolve two heads (i.e. the current branch and another branch you pulled from) using a 3-way merge algorithm. It tries to carefully detect criss-cross merge ambiguities. It does not handle renames.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-octopus"> <a class="anchor" href="#Documentation/git-merge.txt-octopus"></a>octopus </dt> <dd> <p>This resolves cases with more than two heads, but refuses to do a complex merge that needs manual resolution. It is primarily meant to be used for bundling topic branch heads together. This is the default merge strategy when pulling or merging more than one branch.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-ours-1"> <a class="anchor" href="#Documentation/git-merge.txt-ours-1"></a>ours </dt> <dd> <p>This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches. It is meant to be used to supersede old development history of side branches. Note that this is different from the -Xours option to the <em>recursive</em> merge strategy.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-subtree"> <a class="anchor" href="#Documentation/git-merge.txt-subtree"></a>subtree </dt> <dd> <p>This is a modified recursive strategy. When merging trees A and B, if B corresponds to a subtree of A, B is first adjusted to match the tree structure of A, instead of reading the trees at the same level. This adjustment is also done to the common ancestor tree.</p> </dd> </dl> </div> <div class="paragraph"> <p>With the strategies that use 3-way merge (including the default, <em>recursive</em>), if a change is made on both branches, but later reverted on one of the branches, that change will be present in the merged result; some people find this behavior confusing. It occurs because only the heads and the merge base are considered when performing a merge, not the individual commits. The merge algorithm therefore considers the reverted change as no change at all, and substitutes the changed version instead.</p> </div> </div> </div> <div class="sect1"> <h2 id="_configuration"><a class="anchor" href="#_configuration"></a>CONFIGURATION</h2> <div class="sectionbody"> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-merge.txt-mergeconflictStyle"> <a class="anchor" href="#Documentation/git-merge.txt-mergeconflictStyle"></a>merge.conflictStyle </dt> <dd> <p>Specify the style in which conflicted hunks are written out to working tree files upon merge. The default is "merge", which shows a <code>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</code> conflict marker, changes made by one side, a <code>=======</code> marker, changes made by the other side, and then a <code>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</code> marker. An alternate style, "diff3", adds a <code>|||||||</code> marker and the original text before the <code>=======</code> marker.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergedefaultToUpstream"> <a class="anchor" href="#Documentation/git-merge.txt-mergedefaultToUpstream"></a>merge.defaultToUpstream </dt> <dd> <p>If merge is called without any commit argument, merge the upstream branches configured for the current branch by using their last observed values stored in their remote-tracking branches. The values of the <code>branch.&lt;current branch&gt;.merge</code> that name the branches at the remote named by <code>branch.&lt;current branch&gt;.remote</code> are consulted, and then they are mapped via <code>remote.&lt;remote&gt;.fetch</code> to their corresponding remote-tracking branches, and the tips of these tracking branches are merged. Defaults to true.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergeff"> <a class="anchor" href="#Documentation/git-merge.txt-mergeff"></a>merge.ff </dt> <dd> <p>By default, Git does not create an extra merge commit when merging a commit that is a descendant of the current commit. Instead, the tip of the current branch is fast-forwarded. When set to <code>false</code>, this variable tells Git to create an extra merge commit in such a case (equivalent to giving the <code>--no-ff</code> option from the command line). When set to <code>only</code>, only such fast-forward merges are allowed (equivalent to giving the <code>--ff-only</code> option from the command line).</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergeverifySignatures"> <a class="anchor" href="#Documentation/git-merge.txt-mergeverifySignatures"></a>merge.verifySignatures </dt> <dd> <p>If true, this is equivalent to the --verify-signatures command line option. See <a href='/docs/git-merge'>git-merge[1]</a> for details.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergebranchdesc"> <a class="anchor" href="#Documentation/git-merge.txt-mergebranchdesc"></a>merge.branchdesc </dt> <dd> <p>In addition to branch names, populate the log message with the branch description text associated with them. Defaults to false.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergelog"> <a class="anchor" href="#Documentation/git-merge.txt-mergelog"></a>merge.log </dt> <dd> <p>In addition to branch names, populate the log message with at most the specified number of one-line descriptions from the actual commits that are being merged. Defaults to false, and true is a synonym for 20.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergesuppressDest"> <a class="anchor" href="#Documentation/git-merge.txt-mergesuppressDest"></a>merge.suppressDest </dt> <dd> <p>By adding a glob that matches the names of integration branches to this multi-valued configuration variable, the default merge message computed for merges into these integration branches will omit "into &lt;branch name&gt;" from its title.</p> <div class="paragraph"> <p>An element with an empty value can be used to clear the list of globs accumulated from previous configuration entries. When there is no <code>merge.suppressDest</code> variable defined, the default value of <code>master</code> is used for backward compatibility.</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergerenameLimit"> <a class="anchor" href="#Documentation/git-merge.txt-mergerenameLimit"></a>merge.renameLimit </dt> <dd> <p>The number of files to consider in the exhaustive portion of rename detection during a merge. If not specified, defaults to the value of diff.renameLimit. If neither merge.renameLimit nor diff.renameLimit are specified, currently defaults to 7000. This setting has no effect if rename detection is turned off.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergerenames"> <a class="anchor" href="#Documentation/git-merge.txt-mergerenames"></a>merge.renames </dt> <dd> <p>Whether Git detects renames. If set to "false", rename detection is disabled. If set to "true", basic rename detection is enabled. Defaults to the value of diff.renames.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergedirectoryRenames"> <a class="anchor" href="#Documentation/git-merge.txt-mergedirectoryRenames"></a>merge.directoryRenames </dt> <dd> <p>Whether Git detects directory renames, affecting what happens at merge time to new files added to a directory on one side of history when that directory was renamed on the other side of history. If merge.directoryRenames is set to "false", directory rename detection is disabled, meaning that such new files will be left behind in the old directory. If set to "true", directory rename detection is enabled, meaning that such new files will be moved into the new directory. If set to "conflict", a conflict will be reported for such paths. If merge.renames is false, merge.directoryRenames is ignored and treated as false. Defaults to "conflict".</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergerenormalize"> <a class="anchor" href="#Documentation/git-merge.txt-mergerenormalize"></a>merge.renormalize </dt> <dd> <p>Tell Git that canonical representation of files in the repository has changed over time (e.g. earlier commits record text files with CRLF line endings, but recent ones use LF line endings). In such a repository, Git can convert the data recorded in commits to a canonical form before performing a merge to reduce unnecessary conflicts. For more information, see section "Merging branches with differing checkin/checkout attributes" in <a href='/docs/gitattributes'>gitattributes[5]</a>.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergestat"> <a class="anchor" href="#Documentation/git-merge.txt-mergestat"></a>merge.stat </dt> <dd> <p>Whether to print the diffstat between ORIG_HEAD and the merge result at the end of the merge. True by default.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergeautoStash"> <a class="anchor" href="#Documentation/git-merge.txt-mergeautoStash"></a>merge.autoStash </dt> <dd> <p>When set to true, automatically create a temporary stash entry before the operation begins, and apply it after the operation ends. This means that you can run merge on a dirty worktree. However, use with care: the final stash application after a successful merge might result in non-trivial conflicts. This option can be overridden by the <code>--no-autostash</code> and <code>--autostash</code> options of <a href='/docs/git-merge'>git-merge[1]</a>. Defaults to false.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergetool"> <a class="anchor" href="#Documentation/git-merge.txt-mergetool"></a>merge.tool </dt> <dd> <p>Controls which merge tool is used by <a href='/docs/git-mergetool'>git-mergetool[1]</a>. The list below shows the valid built-in values. Any other value is treated as a custom merge tool and requires that a corresponding mergetool.&lt;tool&gt;.cmd variable is defined.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergeguitool"> <a class="anchor" href="#Documentation/git-merge.txt-mergeguitool"></a>merge.guitool </dt> <dd> <p>Controls which merge tool is used by <a href='/docs/git-mergetool'>git-mergetool[1]</a> when the -g/--gui flag is specified. The list below shows the valid built-in values. Any other value is treated as a custom merge tool and requires that a corresponding mergetool.&lt;guitool&gt;.cmd variable is defined.</p> <div class="ulist"> <ul> <li> <p>araxis</p> </li> <li> <p>bc</p> </li> <li> <p>codecompare</p> </li> <li> <p>deltawalker</p> </li> <li> <p>diffmerge</p> </li> <li> <p>diffuse</p> </li> <li> <p>ecmerge</p> </li> <li> <p>emerge</p> </li> <li> <p>examdiff</p> </li> <li> <p>guiffy</p> </li> <li> <p>gvimdiff</p> </li> <li> <p>kdiff3</p> </li> <li> <p>meld</p> </li> <li> <p>nvimdiff</p> </li> <li> <p>opendiff</p> </li> <li> <p>p4merge</p> </li> <li> <p>smerge</p> </li> <li> <p>tkdiff</p> </li> <li> <p>tortoisemerge</p> </li> <li> <p>vimdiff</p> </li> <li> <p>winmerge</p> </li> <li> <p>xxdiff</p> </li> </ul> </div> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergeverbosity"> <a class="anchor" href="#Documentation/git-merge.txt-mergeverbosity"></a>merge.verbosity </dt> <dd> <p>Controls the amount of output shown by the recursive merge strategy. Level 0 outputs nothing except a final error message if conflicts were detected. Level 1 outputs only conflicts, 2 outputs conflicts and file changes. Level 5 and above outputs debugging information. The default is level 2. Can be overridden by the <code>GIT_MERGE_VERBOSITY</code> environment variable.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergeltdrivergtname"> <a class="anchor" href="#Documentation/git-merge.txt-mergeltdrivergtname"></a>merge.&lt;driver&gt;.name </dt> <dd> <p>Defines a human-readable name for a custom low-level merge driver. See <a href='/docs/gitattributes'>gitattributes[5]</a> for details.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergeltdrivergtdriver"> <a class="anchor" href="#Documentation/git-merge.txt-mergeltdrivergtdriver"></a>merge.&lt;driver&gt;.driver </dt> <dd> <p>Defines the command that implements a custom low-level merge driver. See <a href='/docs/gitattributes'>gitattributes[5]</a> for details.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-mergeltdrivergtrecursive"> <a class="anchor" href="#Documentation/git-merge.txt-mergeltdrivergtrecursive"></a>merge.&lt;driver&gt;.recursive </dt> <dd> <p>Names a low-level merge driver to be used when performing an internal merge between common ancestors. See <a href='/docs/gitattributes'>gitattributes[5]</a> for details.</p> </dd> <dt class="hdlist1" id="Documentation/git-merge.txt-branchltnamegtmergeOptions"> <a class="anchor" href="#Documentation/git-merge.txt-branchltnamegtmergeOptions"></a>branch.&lt;name&gt;.mergeOptions </dt> <dd> <p>Sets default options for merging into branch &lt;name&gt;. The syntax and supported options are the same as those of <em>git merge</em>, but option values containing whitespace characters are currently not supported.</p> </dd> </dl> </div> </div> </div> <div class="sect1"> <h2 id="_see_also"><a class="anchor" href="#_see_also"></a>SEE ALSO</h2> <div class="sectionbody"> <div class="paragraph"> <p><a href='/docs/git-fmt-merge-msg'>git-fmt-merge-msg[1]</a>, <a href='/docs/git-pull'>git-pull[1]</a>, <a href='/docs/gitattributes'>gitattributes[5]</a>, <a href='/docs/git-reset'>git-reset[1]</a>, <a href='/docs/git-diff'>git-diff[1]</a>, <a href='/docs/git-ls-files'>git-ls-files[1]</a>, <a href='/docs/git-add'>git-add[1]</a>, <a href='/docs/git-rm'>git-rm[1]</a>, <a href='/docs/git-mergetool'>git-mergetool[1]</a></p> </div> </div> </div> <div class="sect1"> <h2 id="_git"><a class="anchor" href="#_git"></a>GIT</h2> <div class="sectionbody"> <div class="paragraph"> <p>Part of the <a href='/docs/git'>git[1]</a> suite</p> </div> </div> </div> <h3 hidden="true" data-pagefind-weight="10">merge</h3> </div> </div> </div> <footer> <div class="site-source"> <a href="/site">About this site</a><br> Patches, suggestions, and comments are welcome. </div> <div class="sfc-member"> Git is a member of <a href="/sfc">Software Freedom Conservancy</a> </div> </footer> <a href="#top" class="no-js scrollToTop" id="scrollToTop" data-label="Scroll to top"> <img src="/images/icons/chevron-up@2x.png" width="20" height="20" alt="scroll-to-top"/> </a> <script src="/js/jquery-1.7.1.min.js"></script> <script src="/js/jquery-ui-1.8.18.custom.min.js"></script> <script src="/js/jquery.defaultvalue.js"></script> <script src="/js/session.min.js"></script> <script src="/js/modernizr.js"></script> <script src="/js/modernize.js"></script> <script src="/js/application.min.js"></script> </div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10