blob: 426cf144a313b1879e5403f334ec5824bf7f2a48 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamano7bd050f2011-09-22 06:32:226<meta name="generator" content="AsciiDoc 8.5.2" />
Junio C Hamano68cf15a2010-11-06 01:01:597<title>git-merge(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:238<style type="text/css">
9/* Debug borders */
10p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11/*
12 border: 1px solid red;
13*/
14}
15
16body {
17 margin: 1em 5% 1em 5%;
18}
19
Junio C Hamanoba4b9282008-07-06 05:20:3120a {
21 color: blue;
22 text-decoration: underline;
23}
24a:visited {
25 color: fuchsia;
26}
Junio C Hamano1a4e8412005-12-27 08:17:2327
28em {
29 font-style: italic;
Junio C Hamano68cf15a2010-11-06 01:01:5930 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2331}
32
33strong {
34 font-weight: bold;
Junio C Hamano68cf15a2010-11-06 01:01:5935 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2336}
37
38tt {
39 color: navy;
40}
41
42h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
48}
49
Junio C Hamanoba4b9282008-07-06 05:20:3150h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 border-bottom: 2px solid silver;
52}
53h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2354 padding-top: 0.5em;
55}
Junio C Hamanoba4b9282008-07-06 05:20:3156h3 {
57 float: left;
58}
59h3 + * {
60 clear: left;
61}
Junio C Hamano1a4e8412005-12-27 08:17:2362
63div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
66}
67
68hr {
69 border: 1px solid silver;
70}
71
72p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
75}
76
Junio C Hamano68cf15a2010-11-06 01:01:5977ul, ol, li > p {
78 margin-top: 0;
79}
80
Junio C Hamano1a4e8412005-12-27 08:17:2381pre {
82 padding: 0;
83 margin: 0;
84}
85
86span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3190 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2391}
92span#email {
93}
Junio C Hamano68cf15a2010-11-06 01:01:5994span#revnumber, span#revdate, span#revremark {
Junio C Hamano1a4e8412005-12-27 08:17:2395 font-family: sans-serif;
96}
97
98div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
104}
105div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
108}
109div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
112}
113
Junio C Hamano68cf15a2010-11-06 01:01:59114div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
117}
Junio C Hamano1a4e8412005-12-27 08:17:23118div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22121 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23122 margin-bottom: 1.5em;
123}
124div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22125 margin-top: 2.0em;
126 margin-bottom: 2.0em;
127 margin-right: 10%;
128 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23129}
130
131div.content { /* Block element content. */
132 padding: 0;
133}
134
135/* Block element titles. */
136div.title, caption.title {
Junio C Hamano68cf15a2010-11-06 01:01:59137 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23138 font-family: sans-serif;
139 font-weight: bold;
140 text-align: left;
141 margin-top: 1.0em;
142 margin-bottom: 0.5em;
143}
144div.title + * {
145 margin-top: 0;
146}
147
148td div.title:first-child {
149 margin-top: 0.0em;
150}
151div.content div.title:first-child {
152 margin-top: 0.0em;
153}
154div.content + div.title {
155 margin-top: 0.0em;
156}
157
158div.sidebarblock > div.content {
159 background: #ffffee;
160 border: 1px solid silver;
161 padding: 0.5em;
162}
163
164div.listingblock > div.content {
165 border: 1px solid silver;
166 background: #f4f4f4;
167 padding: 0.5em;
168}
169
Junio C Hamano7bd050f2011-09-22 06:32:22170div.quoteblock, div.verseblock {
171 padding-left: 1.0em;
172 margin-left: 1.0em;
Junio C Hamano68cf15a2010-11-06 01:01:59173 margin-right: 10%;
Junio C Hamano7bd050f2011-09-22 06:32:22174 border-left: 5px solid #dddddd;
175 color: #777777;
Junio C Hamano1a4e8412005-12-27 08:17:23176}
Junio C Hamano7bd050f2011-09-22 06:32:22177
Junio C Hamano68cf15a2010-11-06 01:01:59178div.quoteblock > div.attribution {
179 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23180 text-align: right;
181}
Junio C Hamano68cf15a2010-11-06 01:01:59182
Junio C Hamano68cf15a2010-11-06 01:01:59183div.verseblock > div.content {
184 white-space: pre;
185}
186div.verseblock > div.attribution {
187 padding-top: 0.75em;
188 text-align: left;
189}
190/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31191div.verseblock + div.attribution {
192 text-align: left;
193}
Junio C Hamano1a4e8412005-12-27 08:17:23194
195div.admonitionblock .icon {
196 vertical-align: top;
197 font-size: 1.1em;
198 font-weight: bold;
199 text-decoration: underline;
200 color: #527bbd;
201 padding-right: 0.5em;
202}
203div.admonitionblock td.content {
204 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22205 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23206}
207
208div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22209 border-left: 3px solid #dddddd;
210 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23211}
212
Junio C Hamano1a4e8412005-12-27 08:17:23213div.imageblock div.content { padding-left: 0; }
Junio C Hamano1a4e8412005-12-27 08:17:23214span.image img { border-style: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59215a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23216
217dl {
218 margin-top: 0.8em;
219 margin-bottom: 0.8em;
220}
221dt {
222 margin-top: 0.5em;
223 margin-bottom: 0;
Junio C Hamano68cf15a2010-11-06 01:01:59224 font-style: normal;
225 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23226}
227dd > *:first-child {
Junio C Hamano68cf15a2010-11-06 01:01:59228 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23229}
230
231ul, ol {
232 list-style-position: outside;
233}
Junio C Hamano68cf15a2010-11-06 01:01:59234ol.arabic {
235 list-style-type: decimal;
236}
237ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23238 list-style-type: lower-alpha;
239}
Junio C Hamano68cf15a2010-11-06 01:01:59240ol.upperalpha {
241 list-style-type: upper-alpha;
242}
243ol.lowerroman {
244 list-style-type: lower-roman;
245}
246ol.upperroman {
247 list-style-type: upper-roman;
248}
249
250div.compact ul, div.compact ol,
251div.compact p, div.compact p,
252div.compact div, div.compact div {
253 margin-top: 0.1em;
254 margin-bottom: 0.1em;
255}
Junio C Hamano1a4e8412005-12-27 08:17:23256
257div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31258 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23259}
Junio C Hamano7bd050f2011-09-22 06:32:22260thead, p.table.header {
Junio C Hamano1a4e8412005-12-27 08:17:23261 font-family: sans-serif;
262 font-weight: bold;
263}
264tfoot {
265 font-weight: bold;
266}
Junio C Hamano68cf15a2010-11-06 01:01:59267td > div.verse {
268 white-space: pre;
269}
270p.table {
271 margin-top: 0;
272}
273/* Because the table frame attribute is overriden by CSS in most browsers. */
274div.tableblock > table[frame="void"] {
275 border-style: none;
276}
277div.tableblock > table[frame="hsides"] {
278 border-left-style: none;
279 border-right-style: none;
280}
281div.tableblock > table[frame="vsides"] {
282 border-top-style: none;
283 border-bottom-style: none;
284}
Junio C Hamano1a4e8412005-12-27 08:17:23285
Junio C Hamano68cf15a2010-11-06 01:01:59286
287div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23288 margin-top: 0.8em;
289 margin-bottom: 0.8em;
290}
Junio C Hamano68cf15a2010-11-06 01:01:59291div.hdlist tr {
292 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31293}
Junio C Hamano68cf15a2010-11-06 01:01:59294dt.hdlist1.strong, td.hdlist1.strong {
295 font-weight: bold;
296}
297td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23298 vertical-align: top;
Junio C Hamano68cf15a2010-11-06 01:01:59299 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23300 padding-right: 0.8em;
Junio C Hamano68cf15a2010-11-06 01:01:59301 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23302}
Junio C Hamano68cf15a2010-11-06 01:01:59303td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23304 vertical-align: top;
305}
Junio C Hamano68cf15a2010-11-06 01:01:59306div.hdlist.compact tr {
307 margin: 0;
308 padding-bottom: 0;
309}
310
311.comment {
312 background: yellow;
313}
Junio C Hamano1a4e8412005-12-27 08:17:23314
Junio C Hamano7bd050f2011-09-22 06:32:22315.footnote, .footnoteref {
316 font-size: 0.8em;
317}
318
319span.footnote, span.footnoteref {
320 vertical-align: super;
321}
322
323#footnotes {
324 margin: 20px 0 20px 0;
325 padding: 7px 0 0 0;
326}
327
328#footnotes div.footnote {
329 margin: 0 0 5px 0;
330}
331
332#footnotes hr {
333 border: none;
334 border-top: 1px solid silver;
335 height: 1px;
336 text-align: left;
337 margin-left: 0;
338 width: 20%;
339 min-width: 100px;
340}
341
342
Junio C Hamano1a4e8412005-12-27 08:17:23343@media print {
344 div#footer-badges { display: none; }
345}
Junio C Hamanoba4b9282008-07-06 05:20:31346
Junio C Hamano7bd050f2011-09-22 06:32:22347div#toc {
348 margin-bottom: 2.5em;
349}
350
Junio C Hamanoba4b9282008-07-06 05:20:31351div#toctitle {
352 color: #527bbd;
353 font-family: sans-serif;
354 font-size: 1.1em;
355 font-weight: bold;
356 margin-top: 1.0em;
357 margin-bottom: 0.1em;
358}
359
360div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
361 margin-top: 0;
362 margin-bottom: 0;
363}
364div.toclevel2 {
365 margin-left: 2em;
366 font-size: 0.9em;
367}
368div.toclevel3 {
369 margin-left: 4em;
370 font-size: 0.9em;
371}
372div.toclevel4 {
373 margin-left: 6em;
374 font-size: 0.9em;
375}
Junio C Hamano68cf15a2010-11-06 01:01:59376/* Overrides for manpage documents */
377h1 {
378 padding-top: 0.5em;
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver;
381 border-bottom: 2px solid silver;
382}
383h2 {
384 border-style: none;
385}
386div.sectionbody {
387 margin-left: 5%;
388}
389
390@media print {
391 div#toc { display: none; }
392}
393
Junio C Hamano1a4e8412005-12-27 08:17:23394/* Workarounds for IE6's broken and incomplete CSS2. */
395
396div.sidebar-content {
397 background: #ffffee;
398 border: 1px solid silver;
399 padding: 0.5em;
400}
401div.sidebar-title, div.image-title {
Junio C Hamano68cf15a2010-11-06 01:01:59402 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23403 font-family: sans-serif;
404 font-weight: bold;
405 margin-top: 0.0em;
406 margin-bottom: 0.5em;
407}
408
409div.listingblock div.content {
410 border: 1px solid silver;
411 background: #f4f4f4;
412 padding: 0.5em;
413}
414
Junio C Hamano68cf15a2010-11-06 01:01:59415div.quoteblock-attribution {
416 padding-top: 0.5em;
417 text-align: right;
418}
419
420div.verseblock-content {
421 white-space: pre;
422}
423div.verseblock-attribution {
424 padding-top: 0.75em;
425 text-align: left;
Junio C Hamano1a4e8412005-12-27 08:17:23426}
427
428div.exampleblock-content {
Junio C Hamano7bd050f2011-09-22 06:32:22429 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23430 padding-left: 0.5em;
431}
Junio C Hamanoba4b9282008-07-06 05:20:31432
433/* IE6 sets dynamically generated links as visited. */
434div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23435</style>
Junio C Hamano7bd050f2011-09-22 06:32:22436<script type="text/javascript">
437/*<![CDATA[*/
438window.onload = function(){asciidoc.footnotes();}
439var asciidoc = { // Namespace.
440
441/////////////////////////////////////////////////////////////////////
442// Table Of Contents generator
443/////////////////////////////////////////////////////////////////////
444
445/* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
447 *
448 * Table Of Content generator
449 * Version: 0.4
450 *
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
453 */
454
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
457
458// toclevels = 1..4.
459toc: function (toclevels) {
460
461 function getText(el) {
462 var text = "";
463 for (var i = el.firstChild; i != null; i = i.nextSibling) {
464 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
465 text += i.data;
466 else if (i.firstChild != null)
467 text += getText(i);
468 }
469 return text;
470 }
471
472 function TocEntry(el, text, toclevel) {
473 this.element = el;
474 this.text = text;
475 this.toclevel = toclevel;
476 }
477
478 function tocEntries(el, toclevels) {
479 var result = new Array;
480 var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
483 // browsers).
484 var iterate = function (el) {
485 for (var i = el.firstChild; i != null; i = i.nextSibling) {
486 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
487 var mo = re.exec(i.tagName);
488 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
489 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
490 }
491 iterate(i);
492 }
493 }
494 }
495 iterate(el);
496 return result;
497 }
498
499 var toc = document.getElementById("toc");
500 var entries = tocEntries(document.getElementById("content"), toclevels);
501 for (var i = 0; i < entries.length; ++i) {
502 var entry = entries[i];
503 if (entry.element.id == "")
504 entry.element.id = "_toc_" + i;
505 var a = document.createElement("a");
506 a.href = "#" + entry.element.id;
507 a.appendChild(document.createTextNode(entry.text));
508 var div = document.createElement("div");
509 div.appendChild(a);
510 div.className = "toclevel" + entry.toclevel;
511 toc.appendChild(div);
512 }
513 if (entries.length == 0)
514 toc.parentNode.removeChild(toc);
515},
516
517
518/////////////////////////////////////////////////////////////////////
519// Footnotes generator
520/////////////////////////////////////////////////////////////////////
521
522/* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
524 */
525
526footnotes: function () {
527 var cont = document.getElementById("content");
528 var noteholder = document.getElementById("footnotes");
529 var spans = cont.getElementsByTagName("span");
530 var refs = {};
531 var n = 0;
532 for (i=0; i<spans.length; i++) {
533 if (spans[i].className == "footnote") {
534 n++;
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder.innerHTML +=
539 "<div class='footnote' id='_footnote_" + n + "'>" +
540 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
541 n + "</a>. " + note + "</div>";
542 spans[i].innerHTML =
543 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
544 "' title='View footnote' class='footnote'>" + n + "</a>]";
545 var id =spans[i].getAttribute("id");
546 if (id != null) refs["#"+id] = n;
547 }
548 }
549 if (n == 0)
550 noteholder.parentNode.removeChild(noteholder);
551 else {
552 // Process footnoterefs.
553 for (i=0; i<spans.length; i++) {
554 if (spans[i].className == "footnoteref") {
555 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
556 href = href.match(/#.*/)[0]; // Because IE return full URL.
557 n = refs[href];
558 spans[i].innerHTML =
559 "[<a href='#_footnote_" + n +
560 "' title='View footnote' class='footnote'>" + n + "</a>]";
561 }
562 }
563 }
564}
565
566}
567/*]]>*/
568</script>
Junio C Hamano1a4e8412005-12-27 08:17:23569</head>
570<body>
571<div id="header">
572<h1>
573git-merge(1) Manual Page
574</h1>
575<h2>NAME</h2>
576<div class="sectionbody">
577<p>git-merge -
Junio C Hamano7c73c662007-01-19 00:37:50578 Join two or more development histories together
Junio C Hamano1a4e8412005-12-27 08:17:23579</p>
580</div>
581</div>
Junio C Hamano7bd050f2011-09-22 06:32:22582<div id="content">
Junio C Hamano68cf15a2010-11-06 01:01:59583<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23584<div class="sectionbody">
Junio C Hamanoee6d9612006-11-27 20:03:22585<div class="verseblock">
Junio C Hamano68cf15a2010-11-06 01:01:59586<div class="verseblock-content"><em>git merge</em> [-n] [--stat] [--no-commit] [--squash]
Junio C Hamanob04bb3f2010-04-14 14:07:36587 [-s &lt;strategy&gt;] [-X &lt;strategy-option&gt;]
Junio C Hamanoa03ac862011-04-02 04:32:29588 [--[no-]rerere-autoupdate] [-m &lt;msg&gt;] [&lt;commit&gt;&#8230;]
Junio C Hamano788eeba2010-12-08 22:50:43589<em>git merge</em> &lt;msg&gt; HEAD &lt;commit&gt;&#8230;
590<em>git merge</em> --abort</div>
Junio C Hamano68cf15a2010-11-06 01:01:59591<div class="verseblock-attribution">
592</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23593</div>
Junio C Hamanoba4b9282008-07-06 05:20:31594<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23595<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59596<div class="paragraph"><p>Incorporates changes from the named commits (since the time their
Junio C Hamanod0d892c2010-01-24 20:06:29597histories diverged from the current branch) into the current
598branch. This command is used by <em>git pull</em> to incorporate changes
599from another repository and can be used by hand to merge changes
600from one branch into another.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59601<div class="paragraph"><p>Assume the following history exists and the current branch is
Junio C Hamanod0d892c2010-01-24 20:06:29602"<tt>master</tt>":</p></div>
603<div class="listingblock">
604<div class="content">
605<pre><tt> A---B---C topic
606 /
607 D---E---F---G master</tt></pre>
608</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59609<div class="paragraph"><p>Then "<tt>git merge topic</tt>" will replay the changes made on the
Junio C Hamanod0d892c2010-01-24 20:06:29610<tt>topic</tt> branch since it diverged from <tt>master</tt> (i.e., <tt>E</tt>) until
611its current commit (<tt>C</tt>) on top of <tt>master</tt>, and record the result
612in a new commit along with the names of the two parent commits and
613a log message from the user describing the changes.</p></div>
614<div class="listingblock">
615<div class="content">
616<pre><tt> A---B---C topic
617 / \
618 D---E---F---G---H master</tt></pre>
619</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59620<div class="paragraph"><p>The second syntax (&lt;msg&gt; <tt>HEAD</tt> &lt;commit&gt;&#8230;) is supported for
Junio C Hamano1974bf22007-10-31 05:57:20621historical reasons. Do not use it from the command line or in
Junio C Hamano1aa40d22010-01-21 17:46:43622new scripts. It is the same as <tt>git merge -m &lt;msg&gt; &lt;commit&gt;&#8230;</tt>.</p></div>
Junio C Hamano788eeba2010-12-08 22:50:43623<div class="paragraph"><p>The third syntax ("<tt>git merge --abort</tt>") can only be run after the
624merge has resulted in conflicts. <em>git merge --abort</em> will abort the
625merge process and try to reconstruct the pre-merge state. However,
626if there were uncommitted changes when the merge started (and
627especially if those changes were further modified after the merge
628was started), <em>git merge --abort</em> will in some cases be unable to
629reconstruct the original (pre-merge) changes. Therefore:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59630<div class="paragraph"><p><strong>Warning</strong>: Running <em>git merge</em> with uncommitted changes is
Junio C Hamano1aa40d22010-01-21 17:46:43631discouraged: while possible, it leaves you in a state that is hard to
632back out of in the case of a conflict.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23633</div>
Junio C Hamanoba4b9282008-07-06 05:20:31634<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23635<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59636<div class="dlist"><dl>
637<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55638--commit
639</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59640<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55641--no-commit
642</dt>
643<dd>
644<p>
645 Perform the merge and commit the result. This option can
646 be used to override --no-commit.
647</p>
Junio C Hamano68cf15a2010-11-06 01:01:59648<div class="paragraph"><p>With --no-commit perform the merge but pretend the merge
Junio C Hamanoc21ab052009-10-31 04:03:55649failed and do not autocommit, to give the user a chance to
650inspect and further tweak the merge result before committing.</p></div>
651</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59652<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55653--ff
654</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59655<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55656--no-ff
657</dt>
658<dd>
659<p>
660 Do not generate a merge commit if the merge resolved as
661 a fast-forward, only update the branch pointer. This is
662 the default behavior of git-merge.
663</p>
Junio C Hamano68cf15a2010-11-06 01:01:59664<div class="paragraph"><p>With --no-ff Generate a merge commit even if the merge
Junio C Hamanoc21ab052009-10-31 04:03:55665resolved as a fast-forward.</p></div>
666</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59667<dt class="hdlist1">
Junio C Hamano3b4609d2010-09-30 00:04:34668--log[=&lt;n&gt;]
Junio C Hamanoc21ab052009-10-31 04:03:55669</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59670<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55671--no-log
672</dt>
673<dd>
674<p>
675 In addition to branch names, populate the log message with
Junio C Hamano3b4609d2010-09-30 00:04:34676 one-line descriptions from at most &lt;n&gt; actual commits that are being
677 merged. See also <a href="git-fmt-merge-msg.html">git-fmt-merge-msg(1)</a>.
Junio C Hamanoc21ab052009-10-31 04:03:55678</p>
Junio C Hamano68cf15a2010-11-06 01:01:59679<div class="paragraph"><p>With --no-log do not list one-line descriptions from the
Junio C Hamanoc21ab052009-10-31 04:03:55680actual commits being merged.</p></div>
681</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59682<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55683--stat
684</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59685<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55686-n
687</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59688<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55689--no-stat
690</dt>
691<dd>
692<p>
693 Show a diffstat at the end of the merge. The diffstat is also
694 controlled by the configuration option merge.stat.
695</p>
Junio C Hamano68cf15a2010-11-06 01:01:59696<div class="paragraph"><p>With -n or --no-stat do not show a diffstat at the end of the
Junio C Hamanoc21ab052009-10-31 04:03:55697merge.</p></div>
698</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59699<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55700--squash
701</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59702<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55703--no-squash
704</dt>
705<dd>
706<p>
707 Produce the working tree and index state as if a real
708 merge happened (except for the merge information),
709 but do not actually make a commit or
710 move the <tt>HEAD</tt>, nor record <tt>$GIT_DIR/MERGE_HEAD</tt> to
711 cause the next <tt>git commit</tt> command to create a merge
712 commit. This allows you to create a single commit on
713 top of the current branch whose effect is the same as
714 merging another branch (or more in case of an octopus).
715</p>
Junio C Hamano68cf15a2010-11-06 01:01:59716<div class="paragraph"><p>With --no-squash perform the merge and commit the result. This
Junio C Hamanoc21ab052009-10-31 04:03:55717option can be used to override --squash.</p></div>
718</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59719<dt class="hdlist1">
Junio C Hamano446ed772009-11-10 22:02:20720--ff-only
721</dt>
722<dd>
723<p>
724 Refuse to merge and exit with a non-zero status unless the
725 current <tt>HEAD</tt> is already up-to-date or the merge can be
726 resolved as a fast-forward.
727</p>
728</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59729<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55730-s &lt;strategy&gt;
731</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59732<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55733--strategy=&lt;strategy&gt;
734</dt>
735<dd>
736<p>
737 Use the given merge strategy; can be supplied more than
738 once to specify them in the order they should be tried.
739 If there is no <tt>-s</tt> option, a built-in list of strategies
Junio C Hamano1aa40d22010-01-21 17:46:43740 is used instead (<em>git merge-recursive</em> when merging a single
741 head, <em>git merge-octopus</em> otherwise).
Junio C Hamanoc21ab052009-10-31 04:03:55742</p>
743</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59744<dt class="hdlist1">
Junio C Hamanob04bb3f2010-04-14 14:07:36745-X &lt;option&gt;
746</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59747<dt class="hdlist1">
Junio C Hamanob04bb3f2010-04-14 14:07:36748--strategy-option=&lt;option&gt;
749</dt>
750<dd>
751<p>
752 Pass merge strategy specific option through to the merge
753 strategy.
754</p>
755</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59756<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55757--summary
758</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59759<dt class="hdlist1">
Junio C Hamanoc21ab052009-10-31 04:03:55760--no-summary
761</dt>
762<dd>
763<p>
764 Synonyms to --stat and --no-stat; these are deprecated and will be
765 removed in the future.
766</p>
767</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59768<dt class="hdlist1">
Junio C Hamano610d1762008-11-28 06:27:13769-q
770</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59771<dt class="hdlist1">
Junio C Hamano610d1762008-11-28 06:27:13772--quiet
773</dt>
774<dd>
775<p>
Junio C Hamanod2c978f2011-03-20 19:42:22776 Operate quietly. Implies --no-progress.
Junio C Hamano610d1762008-11-28 06:27:13777</p>
778</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59779<dt class="hdlist1">
Junio C Hamano610d1762008-11-28 06:27:13780-v
781</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59782<dt class="hdlist1">
Junio C Hamano610d1762008-11-28 06:27:13783--verbose
784</dt>
785<dd>
786<p>
787 Be verbose.
788</p>
789</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59790<dt class="hdlist1">
Junio C Hamanod2c978f2011-03-20 19:42:22791--progress
792</dt>
793<dt class="hdlist1">
794--no-progress
795</dt>
796<dd>
797<p>
798 Turn progress on/off explicitly. If neither is specified,
799 progress is shown if standard error is connected to a terminal.
800 Note that not all merge strategies may support progress
801 reporting.
802</p>
803</dd>
804<dt class="hdlist1">
Junio C Hamano1974bf22007-10-31 05:57:20805-m &lt;msg&gt;
Junio C Hamano1a4e8412005-12-27 08:17:23806</dt>
807<dd>
808<p>
Junio C Hamanoc0e55e72009-10-10 00:56:29809 Set the commit message to be used for the merge commit (in
Junio C Hamanof5de4cf2010-06-19 00:33:17810 case one is created).
Junio C Hamano1a4e8412005-12-27 08:17:23811</p>
Junio C Hamano68cf15a2010-11-06 01:01:59812<div class="paragraph"><p>If <tt>--log</tt> is specified, a shortlog of the commits being merged
813will be appended to the specified message.</p></div>
814<div class="paragraph"><p>The <em>git fmt-merge-msg</em> command can be
815used to give a good default for automated <em>git merge</em>
816invocations.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23817</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59818<dt class="hdlist1">
Junio C Hamano19107ef2010-01-19 06:20:59819--rerere-autoupdate
820</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59821<dt class="hdlist1">
Junio C Hamano19107ef2010-01-19 06:20:59822--no-rerere-autoupdate
823</dt>
824<dd>
825<p>
826 Allow the rerere mechanism to update the index with the
827 result of auto-conflict resolution if possible.
828</p>
829</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59830<dt class="hdlist1">
Junio C Hamano788eeba2010-12-08 22:50:43831--abort
832</dt>
833<dd>
834<p>
835 Abort the current conflict resolution process, and
836 try to reconstruct the pre-merge state.
837</p>
838<div class="paragraph"><p>If there were uncommitted worktree changes present when the merge
839started, <em>git merge --abort</em> will in some cases be unable to
840reconstruct these changes. It is therefore recommended to always
841commit or stash your changes before running <em>git merge</em>.</p></div>
842<div class="paragraph"><p><em>git merge --abort</em> is equivalent to <em>git reset --merge</em> when
843<tt>MERGE_HEAD</tt> is present.</p></div>
844</dd>
845<dt class="hdlist1">
Junio C Hamano1aa40d22010-01-21 17:46:43846&lt;commit&gt;&#8230;
Junio C Hamano1a4e8412005-12-27 08:17:23847</dt>
848<dd>
849<p>
Junio C Hamano1aa40d22010-01-21 17:46:43850 Commits, usually other branch heads, to merge into our branch.
Junio C Hamanoa03ac862011-04-02 04:32:29851 Specifying more than one commit will create a merge with
852 more than two parents (affectionately called an Octopus merge).
Junio C Hamano1a4e8412005-12-27 08:17:23853</p>
Junio C Hamanoa03ac862011-04-02 04:32:29854<div class="paragraph"><p>If no commit is given from the command line, and if <tt>merge.defaultToUpstream</tt>
855configuration variable is set, merge the remote tracking branches
856that the current branch is configured to use as its upstream.
857See also the configuration section of this manual page.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23858</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31859</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:23860</div>
Junio C Hamanod0d892c2010-01-24 20:06:29861<h2 id="_pre_merge_checks">PRE-MERGE CHECKS</h2>
862<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59863<div class="paragraph"><p>Before applying outside changes, you should get your own work in
Junio C Hamanod0d892c2010-01-24 20:06:29864good shape and committed locally, so it will not be clobbered if
865there are conflicts. See also <a href="git-stash.html">git-stash(1)</a>.
866<em>git pull</em> and <em>git merge</em> will stop without doing anything when
867local uncommitted changes overlap with files that <em>git pull</em>/<em>git
868merge</em> may need to update.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59869<div class="paragraph"><p>To avoid recording unrelated changes in the merge commit,
Junio C Hamanod0d892c2010-01-24 20:06:29870<em>git pull</em> and <em>git merge</em> will also abort if there are any changes
871registered in the index relative to the <tt>HEAD</tt> commit. (One
872exception is when the changed index entries are in the state that
873would result from the merge already.)</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59874<div class="paragraph"><p>If all named commits are already ancestors of <tt>HEAD</tt>, <em>git merge</em>
Junio C Hamanod0d892c2010-01-24 20:06:29875will exit early with the message "Already up-to-date."</p></div>
876</div>
877<h2 id="_fast_forward_merge">FAST-FORWARD MERGE</h2>
878<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59879<div class="paragraph"><p>Often the current branch head is an ancestor of the named commit.
Junio C Hamanod0d892c2010-01-24 20:06:29880This is the most common case especially when invoked from <em>git
881pull</em>: you are tracking an upstream repository, you have committed
882no local changes, and now you want to update to a newer upstream
883revision. In this case, a new commit is not needed to store the
884combined history; instead, the <tt>HEAD</tt> (along with the index) is
885updated to point at the named commit, without creating an extra
886merge commit.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59887<div class="paragraph"><p>This behavior can be suppressed with the <tt>--no-ff</tt> option.</p></div>
Junio C Hamanod0d892c2010-01-24 20:06:29888</div>
889<h2 id="_true_merge">TRUE MERGE</h2>
890<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59891<div class="paragraph"><p>Except in a fast-forward merge (see above), the branches to be
Junio C Hamanod0d892c2010-01-24 20:06:29892merged must be tied together by a merge commit that has both of them
893as its parents.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59894<div class="paragraph"><p>A merged version reconciling the changes from all branches to be
Junio C Hamanod0d892c2010-01-24 20:06:29895merged is committed, and your <tt>HEAD</tt>, index, and working tree are
896updated to it. It is possible to have modifications in the working
897tree as long as they do not overlap; the update will preserve them.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59898<div class="paragraph"><p>When it is not obvious how to reconcile the changes, the following
Junio C Hamanod0d892c2010-01-24 20:06:29899happens:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59900<div class="olist arabic"><ol class="arabic">
Junio C Hamanod0d892c2010-01-24 20:06:29901<li>
902<p>
903The <tt>HEAD</tt> pointer stays the same.
904</p>
905</li>
906<li>
907<p>
908The <tt>MERGE_HEAD</tt> ref is set to point to the other branch head.
909</p>
910</li>
911<li>
912<p>
913Paths that merged cleanly are updated both in the index file and
914 in your working tree.
915</p>
916</li>
917<li>
918<p>
919For conflicting paths, the index file records up to three
920 versions: stage 1 stores the version from the common ancestor,
921 stage 2 from <tt>HEAD</tt>, and stage 3 from <tt>MERGE_HEAD</tt> (you
922 can inspect the stages with <tt>git ls-files -u</tt>). The working
923 tree files contain the result of the "merge" program; i.e. 3-way
924 merge results with familiar conflict markers <tt>&lt;&lt;&lt;</tt> <tt>===</tt> <tt>&gt;&gt;&gt;</tt>.
925</p>
926</li>
927<li>
928<p>
929No other changes are made. In particular, the local
930 modifications you had before you started merge will stay the
931 same and the index entries for them stay as they were,
932 i.e. matching <tt>HEAD</tt>.
933</p>
934</li>
935</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:59936<div class="paragraph"><p>If you tried a merge which resulted in complex conflicts and
Junio C Hamano788eeba2010-12-08 22:50:43937want to start over, you can recover with <tt>git merge --abort</tt>.</p></div>
Junio C Hamanod0d892c2010-01-24 20:06:29938</div>
939<h2 id="_how_conflicts_are_presented">HOW CONFLICTS ARE PRESENTED</h2>
940<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59941<div class="paragraph"><p>During a merge, the working tree files are updated to reflect the result
942of the merge. Among the changes made to the common ancestor&#8217;s version,
Junio C Hamanod0d892c2010-01-24 20:06:29943non-overlapping ones (that is, you changed an area of the file while the
944other side left that area intact, or vice versa) are incorporated in the
945final result verbatim. When both sides made changes to the same area,
946however, git cannot randomly pick one side over the other, and asks you to
947resolve it by leaving what both sides did to that area.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59948<div class="paragraph"><p>By default, git uses the same style as that is used by "merge" program
Junio C Hamanod0d892c2010-01-24 20:06:29949from the RCS suite to present such a conflicted hunk, like this:</p></div>
950<div class="listingblock">
951<div class="content">
952<pre><tt>Here are lines that are either unchanged from the common
953ancestor, or cleanly resolved because only one side changed.
954&lt;&lt;&lt;&lt;&lt;&lt;&lt; yours:sample.txt
955Conflict resolution is hard;
956let's go shopping.
957=======
958Git makes conflict resolution easy.
959&gt;&gt;&gt;&gt;&gt;&gt;&gt; theirs:sample.txt
960And here is another line that is cleanly resolved or unmodified.</tt></pre>
961</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59962<div class="paragraph"><p>The area where a pair of conflicting changes happened is marked with markers
Junio C Hamanod0d892c2010-01-24 20:06:29963<tt>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</tt>, <tt>=======</tt>, and <tt>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</tt>. The part before the <tt>=======</tt>
964is typically your side, and the part afterwards is typically their side.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59965<div class="paragraph"><p>The default format does not show what the original said in the conflicting
Junio C Hamanod0d892c2010-01-24 20:06:29966area. You cannot tell how many lines are deleted and replaced with
Junio C Hamano68cf15a2010-11-06 01:01:59967Barbie&#8217;s remark on your side. The only thing you can tell is that your
968side wants to say it is hard and you&#8217;d prefer to go shopping, while the
Junio C Hamanod0d892c2010-01-24 20:06:29969other side wants to claim it is easy.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59970<div class="paragraph"><p>An alternative style can be used by setting the "merge.conflictstyle"
Junio C Hamanod0d892c2010-01-24 20:06:29971configuration variable to "diff3". In "diff3" style, the above conflict
972may look like this:</p></div>
973<div class="listingblock">
974<div class="content">
975<pre><tt>Here are lines that are either unchanged from the common
976ancestor, or cleanly resolved because only one side changed.
977&lt;&lt;&lt;&lt;&lt;&lt;&lt; yours:sample.txt
978Conflict resolution is hard;
979let's go shopping.
980|||||||
981Conflict resolution is hard.
982=======
983Git makes conflict resolution easy.
984&gt;&gt;&gt;&gt;&gt;&gt;&gt; theirs:sample.txt
985And here is another line that is cleanly resolved or unmodified.</tt></pre>
986</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59987<div class="paragraph"><p>In addition to the <tt>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</tt>, <tt>=======</tt>, and <tt>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</tt> markers, it uses
Junio C Hamanod0d892c2010-01-24 20:06:29988another <tt>|||||||</tt> marker that is followed by the original text. You can
989tell that the original just stated a fact, and your side simply gave in to
990that statement and gave up, while the other side tried to have a more
991positive attitude. You can sometimes come up with a better resolution by
992viewing the original.</p></div>
993</div>
994<h2 id="_how_to_resolve_conflicts">HOW TO RESOLVE CONFLICTS</h2>
995<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59996<div class="paragraph"><p>After seeing a conflict, you can do two things:</p></div>
997<div class="ulist"><ul>
Junio C Hamanod0d892c2010-01-24 20:06:29998<li>
999<p>
1000Decide not to merge. The only clean-ups you need are to reset
1001 the index file to the <tt>HEAD</tt> commit to reverse 2. and to clean
Junio C Hamano788eeba2010-12-08 22:50:431002 up working tree changes made by 2. and 3.; <tt>git merge --abort</tt>
1003 can be used for this.
Junio C Hamanod0d892c2010-01-24 20:06:291004</p>
1005</li>
1006<li>
1007<p>
1008Resolve the conflicts. Git will mark the conflicts in
1009 the working tree. Edit the files into shape and
1010 <em>git add</em> them to the index. Use <em>git commit</em> to seal the deal.
1011</p>
1012</li>
1013</ul></div>
Junio C Hamano68cf15a2010-11-06 01:01:591014<div class="paragraph"><p>You can work through the conflict with a number of tools:</p></div>
1015<div class="ulist"><ul>
Junio C Hamanod0d892c2010-01-24 20:06:291016<li>
1017<p>
1018Use a mergetool. <tt>git mergetool</tt> to launch a graphical
1019 mergetool which will work you through the merge.
1020</p>
1021</li>
1022<li>
1023<p>
1024Look at the diffs. <tt>git diff</tt> will show a three-way diff,
1025 highlighting changes from both the <tt>HEAD</tt> and <tt>MERGE_HEAD</tt>
1026 versions.
1027</p>
1028</li>
1029<li>
1030<p>
1031Look at the diffs from each branch. <tt>git log --merge -p &lt;path&gt;</tt>
1032 will show diffs first for the <tt>HEAD</tt> version and then the
1033 <tt>MERGE_HEAD</tt> version.
1034</p>
1035</li>
1036<li>
1037<p>
1038Look at the originals. <tt>git show :1:filename</tt> shows the
1039 common ancestor, <tt>git show :2:filename</tt> shows the <tt>HEAD</tt>
1040 version, and <tt>git show :3:filename</tt> shows the <tt>MERGE_HEAD</tt>
1041 version.
1042</p>
1043</li>
1044</ul></div>
1045</div>
1046<h2 id="_examples">EXAMPLES</h2>
1047<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591048<div class="ulist"><ul>
Junio C Hamanod0d892c2010-01-24 20:06:291049<li>
1050<p>
1051Merge branches <tt>fixes</tt> and <tt>enhancements</tt> on top of
1052 the current branch, making an octopus merge:
1053</p>
1054<div class="listingblock">
1055<div class="content">
1056<pre><tt>$ git merge fixes enhancements</tt></pre>
1057</div></div>
1058</li>
1059<li>
1060<p>
1061Merge branch <tt>obsolete</tt> into the current branch, using <tt>ours</tt>
1062 merge strategy:
1063</p>
1064<div class="listingblock">
1065<div class="content">
1066<pre><tt>$ git merge -s ours obsolete</tt></pre>
1067</div></div>
1068</li>
1069<li>
1070<p>
1071Merge branch <tt>maint</tt> into the current branch, but do not make
1072 a new commit automatically:
1073</p>
1074<div class="listingblock">
1075<div class="content">
1076<pre><tt>$ git merge --no-commit maint</tt></pre>
1077</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591078<div class="paragraph"><p>This can be used when you want to include further changes to the
Junio C Hamanod0d892c2010-01-24 20:06:291079merge, or want to write your own merge commit message.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591080<div class="paragraph"><p>You should refrain from abusing this option to sneak substantial
Junio C Hamanod0d892c2010-01-24 20:06:291081changes into a merge commit. Small fixups like bumping
1082release/version name would be acceptable.</p></div>
1083</li>
1084</ul></div>
1085</div>
Junio C Hamanoba4b9282008-07-06 05:20:311086<h2 id="_merge_strategies">MERGE STRATEGIES</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231087<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591088<div class="paragraph"><p>The merge mechanism (<em>git-merge</em> and <em>git-pull</em> commands) allows the
Junio C Hamano1aa40d22010-01-21 17:46:431089backend <em>merge strategies</em> to be chosen with <tt>-s</tt> option. Some strategies
1090can also take their own options, which can be passed by giving <tt>-X&lt;option&gt;</tt>
1091arguments to <em>git-merge</em> and/or <em>git-pull</em>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591092<div class="dlist"><dl>
1093<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231094resolve
1095</dt>
1096<dd>
1097<p>
1098 This can only resolve two heads (i.e. the current branch
Junio C Hamano1de75722009-03-26 08:39:381099 and another branch you pulled from) using a 3-way merge
Junio C Hamano1a4e8412005-12-27 08:17:231100 algorithm. It tries to carefully detect criss-cross
1101 merge ambiguities and is considered generally safe and
1102 fast.
1103</p>
1104</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591105<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231106recursive
1107</dt>
1108<dd>
1109<p>
Junio C Hamano1de75722009-03-26 08:39:381110 This can only resolve two heads using a 3-way merge
1111 algorithm. When there is more than one common
1112 ancestor that can be used for 3-way merge, it creates a
Junio C Hamano1a4e8412005-12-27 08:17:231113 merged tree of the common ancestors and uses that as
1114 the reference tree for the 3-way merge. This has been
1115 reported to result in fewer merge conflicts without
1116 causing mis-merges by tests done on actual merge commits
1117 taken from Linux 2.6 kernel development history.
1118 Additionally this can detect and handle merges involving
1119 renames. This is the default merge strategy when
1120 pulling or merging one branch.
1121</p>
Junio C Hamano68cf15a2010-11-06 01:01:591122<div class="paragraph"><p>The <em>recursive</em> strategy can take the following options:</p></div>
1123<div class="dlist"><dl>
1124<dt class="hdlist1">
Junio C Hamano1aa40d22010-01-21 17:46:431125ours
1126</dt>
1127<dd>
1128<p>
1129 This option forces conflicting hunks to be auto-resolved cleanly by
1130 favoring <em>our</em> version. Changes from the other tree that do not
1131 conflict with our side are reflected to the merge result.
1132</p>
Junio C Hamano68cf15a2010-11-06 01:01:591133<div class="paragraph"><p>This should not be confused with the <em>ours</em> merge strategy, which does not
Junio C Hamano1aa40d22010-01-21 17:46:431134even look at what the other tree contains at all. It discards everything
1135the other tree did, declaring <em>our</em> history contains all that happened in it.</p></div>
1136</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591137<dt class="hdlist1">
Junio C Hamano1aa40d22010-01-21 17:46:431138theirs
1139</dt>
1140<dd>
1141<p>
1142 This is opposite of <em>ours</em>.
1143</p>
1144</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591145<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541146patience
1147</dt>
1148<dd>
1149<p>
1150 With this option, <em>merge-recursive</em> spends a little extra time
1151 to avoid mismerges that sometimes occur due to unimportant
1152 matching lines (e.g., braces from distinct functions). Use
1153 this when the branches to be merged have diverged wildly.
1154 See also <a href="git-diff.html">git-diff(1)</a> <tt>--patience</tt>.
1155</p>
1156</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591157<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541158ignore-space-change
1159</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591160<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541161ignore-all-space
1162</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591163<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541164ignore-space-at-eol
1165</dt>
1166<dd>
1167<p>
1168 Treats lines with the indicated type of whitespace change as
1169 unchanged for the sake of a three-way merge. Whitespace
1170 changes mixed with other changes to a line are not ignored.
1171 See also <a href="git-diff.html">git-diff(1)</a> <tt>-b</tt>, <tt>-w</tt>, and
1172 <tt>--ignore-space-at-eol</tt>.
1173</p>
Junio C Hamano68cf15a2010-11-06 01:01:591174<div class="ulist"><ul>
Junio C Hamano39c7a692010-10-27 06:08:541175<li>
1176<p>
1177If <em>their</em> version only introduces whitespace changes to a line,
1178 <em>our</em> version is used;
1179</p>
1180</li>
1181<li>
1182<p>
1183If <em>our</em> version introduces whitespace changes but <em>their</em>
1184 version includes a substantial change, <em>their</em> version is used;
1185</p>
1186</li>
1187<li>
1188<p>
1189Otherwise, the merge proceeds in the usual way.
1190</p>
1191</li>
1192</ul></div>
1193</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591194<dt class="hdlist1">
Junio C Hamano2db3e752010-09-03 21:33:061195renormalize
1196</dt>
1197<dd>
1198<p>
1199 This runs a virtual check-out and check-in of all three stages
1200 of a file when resolving a three-way merge. This option is
1201 meant to be used when merging branches with different clean
1202 filters or end-of-line normalization rules. See "Merging
1203 branches with differing checkin/checkout attributes" in
1204 <a href="gitattributes.html">gitattributes(5)</a> for details.
1205</p>
1206</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591207<dt class="hdlist1">
Junio C Hamano2db3e752010-09-03 21:33:061208no-renormalize
1209</dt>
1210<dd>
1211<p>
1212 Disables the <tt>renormalize</tt> option. This overrides the
1213 <tt>merge.renormalize</tt> configuration variable.
1214</p>
1215</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591216<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541217rename-threshold=&lt;n&gt;
1218</dt>
1219<dd>
1220<p>
1221 Controls the similarity threshold used for rename detection.
1222 See also <a href="git-diff.html">git-diff(1)</a> <tt>-M</tt>.
1223</p>
1224</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591225<dt class="hdlist1">
Junio C Hamanod2179ef2010-10-22 04:12:171226subtree[=&lt;path&gt;]
Junio C Hamano1aa40d22010-01-21 17:46:431227</dt>
1228<dd>
1229<p>
1230 This option is a more advanced form of <em>subtree</em> strategy, where
1231 the strategy makes a guess on how two trees must be shifted to
1232 match with each other when merging. Instead, the specified path
1233 is prefixed (or stripped from the beginning) to make the shape of
1234 two trees to match.
1235</p>
1236</dd>
1237</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231238</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591239<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231240octopus
1241</dt>
1242<dd>
1243<p>
Junio C Hamano1de75722009-03-26 08:39:381244 This resolves cases with more than two heads, but refuses to do
1245 a complex merge that needs manual resolution. It is
Junio C Hamano1a4e8412005-12-27 08:17:231246 primarily meant to be used for bundling topic branch
1247 heads together. This is the default merge strategy when
Junio C Hamano1de75722009-03-26 08:39:381248 pulling or merging more than one branch.
Junio C Hamano1a4e8412005-12-27 08:17:231249</p>
1250</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591251<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231252ours
1253</dt>
1254<dd>
1255<p>
Junio C Hamanobf984de2009-11-23 06:11:191256 This resolves any number of heads, but the resulting tree of the
1257 merge is always that of the current branch head, effectively
1258 ignoring all changes from all other branches. It is meant to
Junio C Hamano1a4e8412005-12-27 08:17:231259 be used to supersede old development history of side
Junio C Hamano1aa40d22010-01-21 17:46:431260 branches. Note that this is different from the -Xours option to
1261 the <em>recursive</em> merge strategy.
Junio C Hamano1a4e8412005-12-27 08:17:231262</p>
1263</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591264<dt class="hdlist1">
Junio C Hamanoe6c92032008-03-19 09:24:341265subtree
1266</dt>
1267<dd>
1268<p>
1269 This is a modified recursive strategy. When merging trees A and
1270 B, if B corresponds to a subtree of A, B is first adjusted to
1271 match the tree structure of A, instead of reading the trees at
1272 the same level. This adjustment is also done to the common
1273 ancestor tree.
1274</p>
1275</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311276</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231277</div>
Junio C Hamanoba4b9282008-07-06 05:20:311278<h2 id="_configuration">CONFIGURATION</h2>
Junio C Hamano1e6e0062007-07-13 05:33:251279<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591280<div class="dlist"><dl>
1281<dt class="hdlist1">
Junio C Hamano4653c6f2008-11-26 22:50:201282merge.conflictstyle
Junio C Hamano1e6e0062007-07-13 05:33:251283</dt>
1284<dd>
1285<p>
Junio C Hamano4653c6f2008-11-26 22:50:201286 Specify the style in which conflicted hunks are written out to
1287 working tree files upon merge. The default is "merge", which
Junio C Hamanoec87f522008-12-10 08:35:251288 shows a <tt>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</tt> conflict marker, changes made by one side,
1289 a <tt>=======</tt> marker, changes made by the other side, and then
1290 a <tt>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</tt> marker. An alternate style, "diff3", adds a <tt>|||||||</tt>
1291 marker and the original text before the <tt>=======</tt> marker.
Junio C Hamano6d76d612008-05-09 05:46:081292</p>
1293</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591294<dt class="hdlist1">
Junio C Hamanoa03ac862011-04-02 04:32:291295merge.defaultToUpstream
1296</dt>
1297<dd>
1298<p>
1299 If merge is called without any commit argument, merge the upstream
1300 branches configured for the current branch by using their last
1301 observed values stored in their remote tracking branches.
1302 The values of the <tt>branch.&lt;current branch&gt;.merge</tt> that name the
1303 branches at the remote named by <tt>branch.&lt;current branch&gt;.remote</tt>
1304 are consulted, and then they are mapped via <tt>remote.&lt;remote&gt;.fetch</tt>
1305 to their corresponding remote tracking branches, and the tips of
1306 these tracking branches are merged.
1307</p>
1308</dd>
1309<dt class="hdlist1">
Junio C Hamano3d050d62011-05-17 06:43:341310merge.ff
1311</dt>
1312<dd>
1313<p>
1314 By default, git does not create an extra merge commit when merging
1315 a commit that is a descendant of the current commit. Instead, the
1316 tip of the current branch is fast-forwarded. When set to <tt>false</tt>,
1317 this variable tells git to create an extra merge commit in such
1318 a case (equivalent to giving the <tt>--no-ff</tt> option from the command
1319 line). When set to <tt>only</tt>, only such fast-forward merges are
1320 allowed (equivalent to giving the <tt>--ff-only</tt> option from the
1321 command line).
1322</p>
1323</dd>
1324<dt class="hdlist1">
Junio C Hamano6d76d612008-05-09 05:46:081325merge.log
1326</dt>
1327<dd>
1328<p>
Junio C Hamano3b4609d2010-09-30 00:04:341329 In addition to branch names, populate the log message with at
1330 most the specified number of one-line descriptions from the
1331 actual commits that are being merged. Defaults to false, and
Junio C Hamano7165bf72011-01-04 22:06:181332 true is a synonym for 20.
Junio C Hamano6d76d612008-05-09 05:46:081333</p>
1334</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591335<dt class="hdlist1">
Junio C Hamano2fbcd212008-05-14 22:26:071336merge.renameLimit
1337</dt>
1338<dd>
1339<p>
1340 The number of files to consider when performing rename detection
1341 during a merge; if not specified, defaults to the value of
1342 diff.renameLimit.
1343</p>
1344</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591345<dt class="hdlist1">
Junio C Hamano2db3e752010-09-03 21:33:061346merge.renormalize
1347</dt>
1348<dd>
1349<p>
1350 Tell git that canonical representation of files in the
1351 repository has changed over time (e.g. earlier commits record
1352 text files with CRLF line endings, but recent ones use LF line
1353 endings). In such a repository, git can convert the data
1354 recorded in commits to a canonical form before performing a
1355 merge to reduce unnecessary conflicts. For more information,
1356 see section "Merging branches with differing checkin/checkout
1357 attributes" in <a href="gitattributes.html">gitattributes(5)</a>.
1358</p>
1359</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591360<dt class="hdlist1">
Junio C Hamano4653c6f2008-11-26 22:50:201361merge.stat
1362</dt>
1363<dd>
1364<p>
1365 Whether to print the diffstat between ORIG_HEAD and the merge result
1366 at the end of the merge. True by default.
1367</p>
1368</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591369<dt class="hdlist1">
Junio C Hamano6d76d612008-05-09 05:46:081370merge.tool
1371</dt>
1372<dd>
1373<p>
1374 Controls which merge resolution program is used by
Junio C Hamanod2c978f2011-03-20 19:42:221375 <a href="git-mergetool.html">git-mergetool(1)</a>. Valid built-in values are: "araxis",
1376 "bc3", "diffuse", "ecmerge", "emerge", "gvimdiff", "kdiff3", "meld",
1377 "opendiff", "p4merge", "tkdiff", "tortoisemerge", "vimdiff"
1378 and "xxdiff". Any other value is treated is custom merge tool
Junio C Hamanocb1c44f2008-08-06 06:19:331379 and there must be a corresponding mergetool.&lt;tool&gt;.cmd option.
Junio C Hamano1e6e0062007-07-13 05:33:251380</p>
1381</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591382<dt class="hdlist1">
Junio C Hamano1e6e0062007-07-13 05:33:251383merge.verbosity
1384</dt>
1385<dd>
1386<p>
1387 Controls the amount of output shown by the recursive merge
1388 strategy. Level 0 outputs nothing except a final error
1389 message if conflicts were detected. Level 1 outputs only
1390 conflicts, 2 outputs conflicts and file changes. Level 5 and
1391 above outputs debugging information. The default is level 2.
Junio C Hamanoec87f522008-12-10 08:35:251392 Can be overridden by the <em>GIT_MERGE_VERBOSITY</em> environment variable.
Junio C Hamano1e6e0062007-07-13 05:33:251393</p>
1394</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591395<dt class="hdlist1">
Junio C Hamano6d76d612008-05-09 05:46:081396merge.&lt;driver&gt;.name
1397</dt>
1398<dd>
1399<p>
Junio C Hamanoec87f522008-12-10 08:35:251400 Defines a human-readable name for a custom low-level
Junio C Hamano6d76d612008-05-09 05:46:081401 merge driver. See <a href="gitattributes.html">gitattributes(5)</a> for details.
1402</p>
1403</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591404<dt class="hdlist1">
Junio C Hamano6d76d612008-05-09 05:46:081405merge.&lt;driver&gt;.driver
1406</dt>
1407<dd>
1408<p>
1409 Defines the command that implements a custom low-level
1410 merge driver. See <a href="gitattributes.html">gitattributes(5)</a> for details.
1411</p>
1412</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591413<dt class="hdlist1">
Junio C Hamano6d76d612008-05-09 05:46:081414merge.&lt;driver&gt;.recursive
1415</dt>
1416<dd>
1417<p>
1418 Names a low-level merge driver to be used when
1419 performing an internal merge between common ancestors.
1420 See <a href="gitattributes.html">gitattributes(5)</a> for details.
1421</p>
1422</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591423<dt class="hdlist1">
Junio C Hamano1b50ce92007-10-03 12:05:531424branch.&lt;name&gt;.mergeoptions
1425</dt>
1426<dd>
1427<p>
1428 Sets default options for merging into branch &lt;name&gt;. The syntax and
Junio C Hamanoc0e55e72009-10-10 00:56:291429 supported options are the same as those of <em>git merge</em>, but option
1430 values containing whitespace characters are currently not supported.
Junio C Hamano1b50ce92007-10-03 12:05:531431</p>
1432</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311433</dl></div>
Junio C Hamano1e6e0062007-07-13 05:33:251434</div>
Junio C Hamanoba4b9282008-07-06 05:20:311435<h2 id="_see_also">SEE ALSO</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231436<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591437<div class="paragraph"><p><a href="git-fmt-merge-msg.html">git-fmt-merge-msg(1)</a>, <a href="git-pull.html">git-pull(1)</a>,
Junio C Hamanofce7c7e2008-07-02 03:06:381438<a href="gitattributes.html">gitattributes(5)</a>,
1439<a href="git-reset.html">git-reset(1)</a>,
1440<a href="git-diff.html">git-diff(1)</a>, <a href="git-ls-files.html">git-ls-files(1)</a>,
1441<a href="git-add.html">git-add(1)</a>, <a href="git-rm.html">git-rm(1)</a>,
Junio C Hamanoba4b9282008-07-06 05:20:311442<a href="git-mergetool.html">git-mergetool(1)</a></p></div>
Junio C Hamanofa2ad882009-12-03 09:15:441443</div>
Junio C Hamanofa2ad882009-12-03 09:15:441444<h2 id="_git">GIT</h2>
1445<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591446<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamanofa2ad882009-12-03 09:15:441447</div>
Junio C Hamano7bd050f2011-09-22 06:32:221448</div>
1449<div id="footnotes"><hr /></div>
Junio C Hamanofa2ad882009-12-03 09:15:441450<div id="footer">
1451<div id="footer-text">
Junio C Hamano7bd050f2011-09-22 06:32:221452Last updated 2011-09-21 23:01:14 PDT
Junio C Hamanofa2ad882009-12-03 09:15:441453</div>
1454</div>
1455</body>
1456</html>