Autogenerated HTML docs for v1.6.5.2-74-g610f9
[git/jnareb-git.git] / git-merge.html
blobece98e6da66b5db46fe5f61b27cf0a98ab00eff6
1 <!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" />
6 <meta name="generator" content="AsciiDoc 8.2.5" />
7 <style type="text/css">
8 /* Debug borders */
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11 border: 1px solid red;
15 body {
16 margin: 1em 5% 1em 5%;
19 a {
20 color: blue;
21 text-decoration: underline;
23 a:visited {
24 color: fuchsia;
27 em {
28 font-style: italic;
31 strong {
32 font-weight: bold;
35 tt {
36 color: navy;
39 h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
47 h1, h2, h3 {
48 border-bottom: 2px solid silver;
50 h2 {
51 padding-top: 0.5em;
53 h3 {
54 float: left;
56 h3 + * {
57 clear: left;
60 div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
65 hr {
66 border: 1px solid silver;
69 p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
74 pre {
75 padding: 0;
76 margin: 0;
79 span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
83 font-size: 1.1em;
85 span#email {
87 span#revision {
88 font-family: sans-serif;
91 div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
98 div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
102 div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
107 div#preamble,
108 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110 div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
115 div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
120 div.content { /* Block element content. */
121 padding: 0;
124 /* Block element titles. */
125 div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
132 div.title + * {
133 margin-top: 0;
136 td div.title:first-child {
137 margin-top: 0.0em;
139 div.content div.title:first-child {
140 margin-top: 0.0em;
142 div.content + div.title {
143 margin-top: 0.0em;
146 div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
152 div.listingblock {
153 margin-right: 0%;
155 div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
161 div.quoteblock > div.content {
162 padding-left: 2.0em;
165 div.attribution {
166 text-align: right;
168 div.verseblock + div.attribution {
169 text-align: left;
172 div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
180 div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
185 div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
190 div.verseblock div.content {
191 white-space: pre;
194 div.imageblock div.content { padding-left: 0; }
195 div.imageblock img { border: 1px solid silver; }
196 span.image img { border-style: none; }
198 dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
202 dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
207 dd > *:first-child {
208 margin-top: 0;
211 ul, ol {
212 list-style-position: outside;
214 div.olist2 ol {
215 list-style-type: lower-alpha;
218 div.tableblock > table {
219 border: 3px solid #527bbd;
221 thead {
222 font-family: sans-serif;
223 font-weight: bold;
225 tfoot {
226 font-weight: bold;
229 div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
233 div.hlist td {
234 padding-bottom: 5px;
236 td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
241 td.hlist2 {
242 vertical-align: top;
245 @media print {
246 div#footer-badges { display: none; }
249 div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
258 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
262 div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
266 div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
270 div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
274 include1::./stylesheets/xhtml11-manpage.css[]
275 /* Workarounds for IE6's broken and incomplete CSS2. */
277 div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
282 div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
289 div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
295 div.quoteblock-content {
296 padding-left: 2.0em;
299 div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
304 /* IE6 sets dynamically generated links as visited. */
305 div#toc a:visited { color: blue; }
306 </style>
307 <title>git-merge(1)</title>
308 </head>
309 <body>
310 <div id="header">
311 <h1>
312 git-merge(1) Manual Page
313 </h1>
314 <h2>NAME</h2>
315 <div class="sectionbody">
316 <p>git-merge -
317 Join two or more development histories together
318 </p>
319 </div>
320 </div>
321 <h2>SYNOPSIS</h2>
322 <div class="sectionbody">
323 <div class="verseblock">
324 <div class="content"><em>git merge</em> [-n] [--stat] [--no-commit] [--squash] [-s &lt;strategy&gt;]&#8230;
325 [-m &lt;msg&gt;] &lt;remote&gt;&#8230;
326 <em>git merge</em> &lt;msg&gt; HEAD &lt;remote&gt;&#8230;</div></div>
327 </div>
328 <h2 id="_description">DESCRIPTION</h2>
329 <div class="sectionbody">
330 <div class="para"><p>This is the top-level interface to the merge machinery
331 which drives multiple merge strategy scripts.</p></div>
332 <div class="para"><p>The second syntax (&lt;msg&gt; <tt>HEAD</tt> &lt;remote&gt;) is supported for
333 historical reasons. Do not use it from the command line or in
334 new scripts. It is the same as <tt>git merge -m &lt;msg&gt; &lt;remote&gt;</tt>.</p></div>
335 </div>
336 <h2 id="_options">OPTIONS</h2>
337 <div class="sectionbody">
338 <div class="vlist"><dl>
339 <dt>
341 </dt>
342 <dt>
343 --quiet
344 </dt>
345 <dd>
347 Operate quietly.
348 </p>
349 </dd>
350 <dt>
352 </dt>
353 <dt>
354 --verbose
355 </dt>
356 <dd>
358 Be verbose.
359 </p>
360 </dd>
361 <dt>
362 --stat
363 </dt>
364 <dd>
366 Show a diffstat at the end of the merge. The diffstat is also
367 controlled by the configuration option merge.stat.
368 </p>
369 </dd>
370 <dt>
372 </dt>
373 <dt>
374 --no-stat
375 </dt>
376 <dd>
378 Do not show a diffstat at the end of the merge.
379 </p>
380 </dd>
381 <dt>
382 --summary
383 </dt>
384 <dt>
385 --no-summary
386 </dt>
387 <dd>
389 Synonyms to --stat and --no-stat; these are deprecated and will be
390 removed in the future.
391 </p>
392 </dd>
393 <dt>
394 --log
395 </dt>
396 <dd>
398 In addition to branch names, populate the log message with
399 one-line descriptions from the actual commits that are being
400 merged.
401 </p>
402 </dd>
403 <dt>
404 --no-log
405 </dt>
406 <dd>
408 Do not list one-line descriptions from the actual commits being
409 merged.
410 </p>
411 </dd>
412 <dt>
413 --no-commit
414 </dt>
415 <dd>
417 Perform the merge but pretend the merge failed and do
418 not autocommit, to give the user a chance to inspect and
419 further tweak the merge result before committing.
420 </p>
421 </dd>
422 <dt>
423 --commit
424 </dt>
425 <dd>
427 Perform the merge and commit the result. This option can
428 be used to override --no-commit.
429 </p>
430 </dd>
431 <dt>
432 --squash
433 </dt>
434 <dd>
436 Produce the working tree and index state as if a real
437 merge happened (except for the merge information),
438 but do not actually make a commit or
439 move the <tt>HEAD</tt>, nor record <tt>$GIT_DIR/MERGE_HEAD</tt> to
440 cause the next <tt>git commit</tt> command to create a merge
441 commit. This allows you to create a single commit on
442 top of the current branch whose effect is the same as
443 merging another branch (or more in case of an octopus).
444 </p>
445 </dd>
446 <dt>
447 --no-squash
448 </dt>
449 <dd>
451 Perform the merge and commit the result. This option can
452 be used to override --squash.
453 </p>
454 </dd>
455 <dt>
456 --no-ff
457 </dt>
458 <dd>
460 Generate a merge commit even if the merge resolved as a
461 fast-forward.
462 </p>
463 </dd>
464 <dt>
465 --ff
466 </dt>
467 <dd>
469 Do not generate a merge commit if the merge resolved as
470 a fast-forward, only update the branch pointer. This is
471 the default behavior of git-merge.
472 </p>
473 </dd>
474 <dt>
475 -s &lt;strategy&gt;
476 </dt>
477 <dt>
478 --strategy=&lt;strategy&gt;
479 </dt>
480 <dd>
482 Use the given merge strategy; can be supplied more than
483 once to specify them in the order they should be tried.
484 If there is no <tt>-s</tt> option, a built-in list of strategies
485 is used instead (<em>git-merge-recursive</em> when merging a single
486 head, <em>git-merge-octopus</em> otherwise).
487 </p>
488 </dd>
489 <dt>
490 -m &lt;msg&gt;
491 </dt>
492 <dd>
494 Set the commit message to be used for the merge commit (in
495 case one is created). The <em>git fmt-merge-msg</em> command can be
496 used to give a good default for automated <em>git merge</em>
497 invocations.
498 </p>
499 </dd>
500 <dt>
501 &lt;remote&gt;&#8230;
502 </dt>
503 <dd>
505 Other branch heads to merge into our branch. You need at
506 least one &lt;remote&gt;. Specifying more than one &lt;remote&gt;
507 obviously means you are trying an Octopus.
508 </p>
509 </dd>
510 </dl></div>
511 </div>
512 <h2 id="_merge_strategies">MERGE STRATEGIES</h2>
513 <div class="sectionbody">
514 <div class="vlist"><dl>
515 <dt>
516 resolve
517 </dt>
518 <dd>
520 This can only resolve two heads (i.e. the current branch
521 and another branch you pulled from) using a 3-way merge
522 algorithm. It tries to carefully detect criss-cross
523 merge ambiguities and is considered generally safe and
524 fast.
525 </p>
526 </dd>
527 <dt>
528 recursive
529 </dt>
530 <dd>
532 This can only resolve two heads using a 3-way merge
533 algorithm. When there is more than one common
534 ancestor that can be used for 3-way merge, it creates a
535 merged tree of the common ancestors and uses that as
536 the reference tree for the 3-way merge. This has been
537 reported to result in fewer merge conflicts without
538 causing mis-merges by tests done on actual merge commits
539 taken from Linux 2.6 kernel development history.
540 Additionally this can detect and handle merges involving
541 renames. This is the default merge strategy when
542 pulling or merging one branch.
543 </p>
544 </dd>
545 <dt>
546 octopus
547 </dt>
548 <dd>
550 This resolves cases with more than two heads, but refuses to do
551 a complex merge that needs manual resolution. It is
552 primarily meant to be used for bundling topic branch
553 heads together. This is the default merge strategy when
554 pulling or merging more than one branch.
555 </p>
556 </dd>
557 <dt>
558 ours
559 </dt>
560 <dd>
562 This resolves any number of heads, but the result of the
563 merge is always the current branch head. It is meant to
564 be used to supersede old development history of side
565 branches.
566 </p>
567 </dd>
568 <dt>
569 subtree
570 </dt>
571 <dd>
573 This is a modified recursive strategy. When merging trees A and
574 B, if B corresponds to a subtree of A, B is first adjusted to
575 match the tree structure of A, instead of reading the trees at
576 the same level. This adjustment is also done to the common
577 ancestor tree.
578 </p>
579 </dd>
580 </dl></div>
581 <div class="para"><p>If you tried a merge which resulted in complex conflicts and
582 want to start over, you can recover with <em>git-reset</em>.</p></div>
583 </div>
584 <h2 id="_configuration">CONFIGURATION</h2>
585 <div class="sectionbody">
586 <div class="vlist"><dl>
587 <dt>
588 merge.conflictstyle
589 </dt>
590 <dd>
592 Specify the style in which conflicted hunks are written out to
593 working tree files upon merge. The default is "merge", which
594 shows a <tt>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</tt> conflict marker, changes made by one side,
595 a <tt>=======</tt> marker, changes made by the other side, and then
596 a <tt>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</tt> marker. An alternate style, "diff3", adds a <tt>|||||||</tt>
597 marker and the original text before the <tt>=======</tt> marker.
598 </p>
599 </dd>
600 <dt>
601 merge.log
602 </dt>
603 <dd>
605 Whether to include summaries of merged commits in newly created
606 merge commit messages. False by default.
607 </p>
608 </dd>
609 <dt>
610 merge.renameLimit
611 </dt>
612 <dd>
614 The number of files to consider when performing rename detection
615 during a merge; if not specified, defaults to the value of
616 diff.renameLimit.
617 </p>
618 </dd>
619 <dt>
620 merge.stat
621 </dt>
622 <dd>
624 Whether to print the diffstat between ORIG_HEAD and the merge result
625 at the end of the merge. True by default.
626 </p>
627 </dd>
628 <dt>
629 merge.tool
630 </dt>
631 <dd>
633 Controls which merge resolution program is used by
634 <a href="git-mergetool.html">git-mergetool(1)</a>. Valid built-in values are: "kdiff3",
635 "tkdiff", "meld", "xxdiff", "emerge", "vimdiff", "gvimdiff",
636 "diffuse", "ecmerge", "tortoisemerge", "araxis", and
637 "opendiff". Any other value is treated is custom merge tool
638 and there must be a corresponding mergetool.&lt;tool&gt;.cmd option.
639 </p>
640 </dd>
641 <dt>
642 merge.verbosity
643 </dt>
644 <dd>
646 Controls the amount of output shown by the recursive merge
647 strategy. Level 0 outputs nothing except a final error
648 message if conflicts were detected. Level 1 outputs only
649 conflicts, 2 outputs conflicts and file changes. Level 5 and
650 above outputs debugging information. The default is level 2.
651 Can be overridden by the <em>GIT_MERGE_VERBOSITY</em> environment variable.
652 </p>
653 </dd>
654 <dt>
655 merge.&lt;driver&gt;.name
656 </dt>
657 <dd>
659 Defines a human-readable name for a custom low-level
660 merge driver. See <a href="gitattributes.html">gitattributes(5)</a> for details.
661 </p>
662 </dd>
663 <dt>
664 merge.&lt;driver&gt;.driver
665 </dt>
666 <dd>
668 Defines the command that implements a custom low-level
669 merge driver. See <a href="gitattributes.html">gitattributes(5)</a> for details.
670 </p>
671 </dd>
672 <dt>
673 merge.&lt;driver&gt;.recursive
674 </dt>
675 <dd>
677 Names a low-level merge driver to be used when
678 performing an internal merge between common ancestors.
679 See <a href="gitattributes.html">gitattributes(5)</a> for details.
680 </p>
681 </dd>
682 <dt>
683 branch.&lt;name&gt;.mergeoptions
684 </dt>
685 <dd>
687 Sets default options for merging into branch &lt;name&gt;. The syntax and
688 supported options are the same as those of <em>git merge</em>, but option
689 values containing whitespace characters are currently not supported.
690 </p>
691 </dd>
692 </dl></div>
693 </div>
694 <h2 id="_how_merge_works">HOW MERGE WORKS</h2>
695 <div class="sectionbody">
696 <div class="para"><p>A merge is always between the current <tt>HEAD</tt> and one or more
697 commits (usually, branch head or tag), and the index file must
698 match the tree of <tt>HEAD</tt> commit (i.e. the contents of the last commit)
699 when it starts out. In other words, <tt>git diff --cached HEAD</tt> must
700 report no changes. (One exception is when the changed index
701 entries are already in the same state that would result from
702 the merge anyway.)</p></div>
703 <div class="para"><p>Three kinds of merge can happen:</p></div>
704 <div class="ilist"><ul>
705 <li>
707 The merged commit is already contained in <tt>HEAD</tt>. This is the
708 simplest case, called "Already up-to-date."
709 </p>
710 </li>
711 <li>
713 <tt>HEAD</tt> is already contained in the merged commit. This is the
714 most common case especially when invoked from <em>git pull</em>:
715 you are tracking an upstream repository, have committed no local
716 changes and now you want to update to a newer upstream revision.
717 Your <tt>HEAD</tt> (and the index) is updated to point at the merged
718 commit, without creating an extra merge commit. This is
719 called "Fast-forward".
720 </p>
721 </li>
722 <li>
724 Both the merged commit and <tt>HEAD</tt> are independent and must be
725 tied together by a merge commit that has both of them as its parents.
726 The rest of this section describes this "True merge" case.
727 </p>
728 </li>
729 </ul></div>
730 <div class="para"><p>The chosen merge strategy merges the two commits into a single
731 new source tree.
732 When things merge cleanly, this is what happens:</p></div>
733 <div class="olist"><ol>
734 <li>
736 The results are updated both in the index file and in your
737 working tree;
738 </p>
739 </li>
740 <li>
742 Index file is written out as a tree;
743 </p>
744 </li>
745 <li>
747 The tree gets committed; and
748 </p>
749 </li>
750 <li>
752 The <tt>HEAD</tt> pointer gets advanced.
753 </p>
754 </li>
755 </ol></div>
756 <div class="para"><p>Because of 2., we require that the original state of the index
757 file matches exactly the current <tt>HEAD</tt> commit; otherwise we
758 will write out your local changes already registered in your
759 index file along with the merge result, which is not good.
760 Because 1. involves only those paths differing between your
761 branch and the remote branch you are pulling from during the
762 merge (which is typically a fraction of the whole tree), you can
763 have local modifications in your working tree as long as they do
764 not overlap with what the merge updates.</p></div>
765 <div class="para"><p>When there are conflicts, the following happens:</p></div>
766 <div class="olist"><ol>
767 <li>
769 <tt>HEAD</tt> stays the same.
770 </p>
771 </li>
772 <li>
774 Cleanly merged paths are updated both in the index file and
775 in your working tree.
776 </p>
777 </li>
778 <li>
780 For conflicting paths, the index file records up to three
781 versions; stage1 stores the version from the common ancestor,
782 stage2 from <tt>HEAD</tt>, and stage3 from the remote branch (you
783 can inspect the stages with <tt>git ls-files -u</tt>). The working
784 tree files contain the result of the "merge" program; i.e. 3-way
785 merge results with familiar conflict markers <tt>&lt;&lt;&lt; === &gt;&gt;&gt;</tt>.
786 </p>
787 </li>
788 <li>
790 No other changes are done. In particular, the local
791 modifications you had before you started merge will stay the
792 same and the index entries for them stay as they were,
793 i.e. matching <tt>HEAD</tt>.
794 </p>
795 </li>
796 </ol></div>
797 </div>
798 <h2 id="_how_conflicts_are_presented">HOW CONFLICTS ARE PRESENTED</h2>
799 <div class="sectionbody">
800 <div class="para"><p>During a merge, the working tree files are updated to reflect the result
801 of the merge. Among the changes made to the common ancestor's version,
802 non-overlapping ones (that is, you changed an area of the file while the
803 other side left that area intact, or vice versa) are incorporated in the
804 final result verbatim. When both sides made changes to the same area,
805 however, git cannot randomly pick one side over the other, and asks you to
806 resolve it by leaving what both sides did to that area.</p></div>
807 <div class="para"><p>By default, git uses the same style as that is used by "merge" program
808 from the RCS suite to present such a conflicted hunk, like this:</p></div>
809 <div class="listingblock">
810 <div class="content">
811 <pre><tt>Here are lines that are either unchanged from the common
812 ancestor, or cleanly resolved because only one side changed.
813 &lt;&lt;&lt;&lt;&lt;&lt;&lt; yours:sample.txt
814 Conflict resolution is hard;
815 let's go shopping.
816 =======
817 Git makes conflict resolution easy.
818 &gt;&gt;&gt;&gt;&gt;&gt;&gt; theirs:sample.txt
819 And here is another line that is cleanly resolved or unmodified.</tt></pre>
820 </div></div>
821 <div class="para"><p>The area where a pair of conflicting changes happened is marked with markers
822 <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>
823 is typically your side, and the part afterwards is typically their side.</p></div>
824 <div class="para"><p>The default format does not show what the original said in the conflicting
825 area. You cannot tell how many lines are deleted and replaced with
826 Barbie's remark on your side. The only thing you can tell is that your
827 side wants to say it is hard and you'd prefer to go shopping, while the
828 other side wants to claim it is easy.</p></div>
829 <div class="para"><p>An alternative style can be used by setting the "merge.conflictstyle"
830 configuration variable to "diff3". In "diff3" style, the above conflict
831 may look like this:</p></div>
832 <div class="listingblock">
833 <div class="content">
834 <pre><tt>Here are lines that are either unchanged from the common
835 ancestor, or cleanly resolved because only one side changed.
836 &lt;&lt;&lt;&lt;&lt;&lt;&lt; yours:sample.txt
837 Conflict resolution is hard;
838 let's go shopping.
839 |||||||
840 Conflict resolution is hard.
841 =======
842 Git makes conflict resolution easy.
843 &gt;&gt;&gt;&gt;&gt;&gt;&gt; theirs:sample.txt
844 And here is another line that is cleanly resolved or unmodified.</tt></pre>
845 </div></div>
846 <div class="para"><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
847 another <tt>|||||||</tt> marker that is followed by the original text. You can
848 tell that the original just stated a fact, and your side simply gave in to
849 that statement and gave up, while the other side tried to have a more
850 positive attitude. You can sometimes come up with a better resolution by
851 viewing the original.</p></div>
852 </div>
853 <h2 id="_how_to_resolve_conflicts">HOW TO RESOLVE CONFLICTS</h2>
854 <div class="sectionbody">
855 <div class="para"><p>After seeing a conflict, you can do two things:</p></div>
856 <div class="ilist"><ul>
857 <li>
859 Decide not to merge. The only clean-ups you need are to reset
860 the index file to the <tt>HEAD</tt> commit to reverse 2. and to clean
861 up working tree changes made by 2. and 3.; <em>git-reset --hard</em> can
862 be used for this.
863 </p>
864 </li>
865 <li>
867 Resolve the conflicts. Git will mark the conflicts in
868 the working tree. Edit the files into shape and
869 <em>git-add</em> them to the index. Use <em>git-commit</em> to seal the deal.
870 </p>
871 </li>
872 </ul></div>
873 <div class="para"><p>You can work through the conflict with a number of tools:</p></div>
874 <div class="ilist"><ul>
875 <li>
877 Use a mergetool. <em>git mergetool</em> to launch a graphical
878 mergetool which will work you through the merge.
879 </p>
880 </li>
881 <li>
883 Look at the diffs. <em>git diff</em> will show a three-way diff,
884 highlighting changes from both the HEAD and remote versions.
885 </p>
886 </li>
887 <li>
889 Look at the diffs on their own. <em>git log --merge -p &lt;path&gt;</em>
890 will show diffs first for the HEAD version and then the
891 remote version.
892 </p>
893 </li>
894 <li>
896 Look at the originals. <em>git show :1:filename</em> shows the
897 common ancestor, <em>git show :2:filename</em> shows the HEAD
898 version and <em>git show :3:filename</em> shows the remote version.
899 </p>
900 </li>
901 </ul></div>
902 </div>
903 <h2 id="_see_also">SEE ALSO</h2>
904 <div class="sectionbody">
905 <div class="para"><p><a href="git-fmt-merge-msg.html">git-fmt-merge-msg(1)</a>, <a href="git-pull.html">git-pull(1)</a>,
906 <a href="gitattributes.html">gitattributes(5)</a>,
907 <a href="git-reset.html">git-reset(1)</a>,
908 <a href="git-diff.html">git-diff(1)</a>, <a href="git-ls-files.html">git-ls-files(1)</a>,
909 <a href="git-add.html">git-add(1)</a>, <a href="git-rm.html">git-rm(1)</a>,
910 <a href="git-mergetool.html">git-mergetool(1)</a></p></div>
911 </div>
912 <h2 id="_author">Author</h2>
913 <div class="sectionbody">
914 <div class="para"><p>Written by Junio C Hamano &lt;gitster@pobox.com&gt;</p></div>
915 </div>
916 <h2 id="_documentation">Documentation</h2>
917 <div class="sectionbody">
918 <div class="para"><p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
919 </div>
920 <h2 id="_git">GIT</h2>
921 <div class="sectionbody">
922 <div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
923 </div>
924 <div id="footer">
925 <div id="footer-text">
926 Last updated 2009-10-10 00:56:05 UTC
927 </div>
928 </div>
929 </body>
930 </html>