blob: 23293d0f4e7efc06600bb9d860fac66412e9217a [file] [log] [blame]
Junio C Hamano40f2f8d2006-02-07 08:04:391<!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 Hamano103b5722011-01-31 05:03:456<meta name="generator" content="AsciiDoc 8.4.5" />
7<title>git-rerere(1)</title>
Junio C Hamano40f2f8d2006-02-07 08:04:398<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 Hamano40f2f8d2006-02-07 08:04:3927
28em {
29 font-style: italic;
Junio C Hamano103b5722011-01-31 05:03:4530 color: navy;
Junio C Hamano40f2f8d2006-02-07 08:04:3931}
32
33strong {
34 font-weight: bold;
Junio C Hamano103b5722011-01-31 05:03:4535 color: #083194;
Junio C Hamano40f2f8d2006-02-07 08:04:3936}
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 Hamano40f2f8d2006-02-07 08:04:3951 border-bottom: 2px solid silver;
52}
53h2 {
Junio C Hamano40f2f8d2006-02-07 08:04:3954 padding-top: 0.5em;
55}
Junio C Hamanoba4b9282008-07-06 05:20:3156h3 {
57 float: left;
58}
59h3 + * {
60 clear: left;
61}
Junio C Hamano40f2f8d2006-02-07 08:04:3962
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 Hamano103b5722011-01-31 05:03:4577ul, ol, li > p {
78 margin-top: 0;
79}
80
Junio C Hamano40f2f8d2006-02-07 08:04:3981pre {
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 Hamano40f2f8d2006-02-07 08:04:3991}
92span#email {
93}
Junio C Hamano103b5722011-01-31 05:03:4594span#revnumber, span#revdate, span#revremark {
Junio C Hamano40f2f8d2006-02-07 08:04:3995 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 Hamano103b5722011-01-31 05:03:45114div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
117}
Junio C Hamano40f2f8d2006-02-07 08:04:39118div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120div.admonitionblock {
Junio C Hamano40f2f8d2006-02-07 08:04:39121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
123}
124div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
127}
128
129div.content { /* Block element content. */
130 padding: 0;
131}
132
133/* Block element titles. */
134div.title, caption.title {
Junio C Hamano103b5722011-01-31 05:03:45135 color: #527bbd;
Junio C Hamano40f2f8d2006-02-07 08:04:39136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
141}
142div.title + * {
143 margin-top: 0;
144}
145
146td div.title:first-child {
147 margin-top: 0.0em;
148}
149div.content div.title:first-child {
150 margin-top: 0.0em;
151}
152div.content + div.title {
153 margin-top: 0.0em;
154}
155
156div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
160}
161
162div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
166}
167
Junio C Hamano103b5722011-01-31 05:03:45168div.quoteblock {
Junio C Hamano40f2f8d2006-02-07 08:04:39169 padding-left: 2.0em;
Junio C Hamano103b5722011-01-31 05:03:45170 margin-right: 10%;
Junio C Hamano40f2f8d2006-02-07 08:04:39171}
Junio C Hamano103b5722011-01-31 05:03:45172div.quoteblock > div.attribution {
173 padding-top: 0.5em;
Junio C Hamano40f2f8d2006-02-07 08:04:39174 text-align: right;
175}
Junio C Hamano103b5722011-01-31 05:03:45176
177div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
180}
181div.verseblock > div.content {
182 white-space: pre;
183}
184div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
187}
188/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31189div.verseblock + div.attribution {
190 text-align: left;
191}
Junio C Hamano40f2f8d2006-02-07 08:04:39192
193div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
200}
201div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
204}
205
206div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
209}
210
Junio C Hamano40f2f8d2006-02-07 08:04:39211div.imageblock div.content { padding-left: 0; }
Junio C Hamano40f2f8d2006-02-07 08:04:39212span.image img { border-style: none; }
Junio C Hamano103b5722011-01-31 05:03:45213a.image:visited { color: white; }
Junio C Hamano40f2f8d2006-02-07 08:04:39214
215dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
218}
219dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
Junio C Hamano103b5722011-01-31 05:03:45222 font-style: normal;
223 color: navy;
Junio C Hamano40f2f8d2006-02-07 08:04:39224}
225dd > *:first-child {
Junio C Hamano103b5722011-01-31 05:03:45226 margin-top: 0.1em;
Junio C Hamano40f2f8d2006-02-07 08:04:39227}
228
229ul, ol {
230 list-style-position: outside;
231}
Junio C Hamano103b5722011-01-31 05:03:45232ol.arabic {
233 list-style-type: decimal;
234}
235ol.loweralpha {
Junio C Hamano40f2f8d2006-02-07 08:04:39236 list-style-type: lower-alpha;
237}
Junio C Hamano103b5722011-01-31 05:03:45238ol.upperalpha {
239 list-style-type: upper-alpha;
240}
241ol.lowerroman {
242 list-style-type: lower-roman;
243}
244ol.upperroman {
245 list-style-type: upper-roman;
246}
247
248div.compact ul, div.compact ol,
249div.compact p, div.compact p,
250div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
253}
Junio C Hamano40f2f8d2006-02-07 08:04:39254
255div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31256 border: 3px solid #527bbd;
Junio C Hamano40f2f8d2006-02-07 08:04:39257}
258thead {
259 font-family: sans-serif;
260 font-weight: bold;
261}
262tfoot {
263 font-weight: bold;
264}
Junio C Hamano103b5722011-01-31 05:03:45265td > div.verse {
266 white-space: pre;
267}
268p.table {
269 margin-top: 0;
270}
271/* Because the table frame attribute is overriden by CSS in most browsers. */
272div.tableblock > table[frame="void"] {
273 border-style: none;
274}
275div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
278}
279div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
282}
Junio C Hamano40f2f8d2006-02-07 08:04:39283
Junio C Hamano103b5722011-01-31 05:03:45284
285div.hdlist {
Junio C Hamano40f2f8d2006-02-07 08:04:39286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
288}
Junio C Hamano103b5722011-01-31 05:03:45289div.hdlist tr {
290 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31291}
Junio C Hamano103b5722011-01-31 05:03:45292dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
294}
295td.hdlist1 {
Junio C Hamano40f2f8d2006-02-07 08:04:39296 vertical-align: top;
Junio C Hamano103b5722011-01-31 05:03:45297 font-style: normal;
Junio C Hamano40f2f8d2006-02-07 08:04:39298 padding-right: 0.8em;
Junio C Hamano103b5722011-01-31 05:03:45299 color: navy;
Junio C Hamano40f2f8d2006-02-07 08:04:39300}
Junio C Hamano103b5722011-01-31 05:03:45301td.hdlist2 {
Junio C Hamano40f2f8d2006-02-07 08:04:39302 vertical-align: top;
303}
Junio C Hamano103b5722011-01-31 05:03:45304div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
307}
308
309.comment {
310 background: yellow;
311}
Junio C Hamano40f2f8d2006-02-07 08:04:39312
313@media print {
314 div#footer-badges { display: none; }
315}
Junio C Hamanoba4b9282008-07-06 05:20:31316
317div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
324}
325
326div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
329}
330div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
333}
334div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
337}
338div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
341}
Junio C Hamano103b5722011-01-31 05:03:45342/* Overrides for manpage documents */
343h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
348}
349h2 {
350 border-style: none;
351}
352div.sectionbody {
353 margin-left: 5%;
354}
355
356@media print {
357 div#toc { display: none; }
358}
359
Junio C Hamano40f2f8d2006-02-07 08:04:39360/* Workarounds for IE6's broken and incomplete CSS2. */
361
362div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
366}
367div.sidebar-title, div.image-title {
Junio C Hamano103b5722011-01-31 05:03:45368 color: #527bbd;
Junio C Hamano40f2f8d2006-02-07 08:04:39369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
373}
374
375div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
379}
380
Junio C Hamano103b5722011-01-31 05:03:45381div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
384}
385
386div.verseblock-content {
387 white-space: pre;
388}
389div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
Junio C Hamano40f2f8d2006-02-07 08:04:39392}
393
394div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
397}
Junio C Hamanoba4b9282008-07-06 05:20:31398
399/* IE6 sets dynamically generated links as visited. */
400div#toc a:visited { color: blue; }
Junio C Hamano40f2f8d2006-02-07 08:04:39401</style>
Junio C Hamano40f2f8d2006-02-07 08:04:39402</head>
403<body>
404<div id="header">
405<h1>
406git-rerere(1) Manual Page
407</h1>
408<h2>NAME</h2>
409<div class="sectionbody">
410<p>git-rerere -
Junio C Hamano7c73c662007-01-19 00:37:50411 Reuse recorded resolution of conflicted merges
Junio C Hamano40f2f8d2006-02-07 08:04:39412</p>
413</div>
414</div>
Junio C Hamano103b5722011-01-31 05:03:45415<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano40f2f8d2006-02-07 08:04:39416<div class="sectionbody">
Junio C Hamanod2c978f2011-03-20 19:42:22417<div class="paragraph"><p><em>git rerere</em> [<em>clear</em>|<em>forget</em> &lt;pathspec&gt;|<em>diff</em>|<em>status</em>|<em>gc</em>]</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39418</div>
Junio C Hamanoba4b9282008-07-06 05:20:31419<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano40f2f8d2006-02-07 08:04:39420<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45421<div class="paragraph"><p>In a workflow employing relatively long lived topic branches,
Junio C Hamano25e7ba62009-06-14 01:03:22422the developer sometimes needs to resolve the same conflicts over
Junio C Hamano40f2f8d2006-02-07 08:04:39423and over again until the topic branches are done (either merged
Junio C Hamanoba4b9282008-07-06 05:20:31424to the "release" branch, or sent out and accepted upstream).</p></div>
Junio C Hamano103b5722011-01-31 05:03:45425<div class="paragraph"><p>This command assists the developer in this process by recording
Junio C Hamano25e7ba62009-06-14 01:03:22426conflicted automerge results and corresponding hand resolve results
427on the initial manual merge, and applying previously recorded
428hand resolutions to their corresponding automerge results.</p></div>
Junio C Hamano0e47b232008-01-15 08:31:10429<div class="admonitionblock">
430<table><tr>
431<td class="icon">
432<div class="title">Note</div>
433</td>
Junio C Hamano543f8d62009-07-29 08:35:21434<td class="content">You need to set the configuration variable rerere.enabled in order to
Junio C Hamano0e47b232008-01-15 08:31:10435enable this command.</td>
436</tr></table>
437</div>
Junio C Hamano40f2f8d2006-02-07 08:04:39438</div>
Junio C Hamanoba4b9282008-07-06 05:20:31439<h2 id="_commands">COMMANDS</h2>
Junio C Hamanoe7935c42006-12-13 21:32:17440<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45441<div class="paragraph"><p>Normally, <em>git rerere</em> is run without arguments or user-intervention.
Junio C Hamanoe7935c42006-12-13 21:32:17442However, it has several commands that allow it to interact with
Junio C Hamanoba4b9282008-07-06 05:20:31443its working state.</p></div>
Junio C Hamano103b5722011-01-31 05:03:45444<div class="dlist"><dl>
445<dt class="hdlist1">
Junio C Hamanoe7935c42006-12-13 21:32:17446<em>clear</em>
447</dt>
448<dd>
449<p>
450This resets the metadata used by rerere if a merge resolution is to be
Junio C Hamano1aa40d22010-01-21 17:46:43451aborted. Calling <em>git am [--skip|--abort]</em> or <em>git rebase [--skip|--abort]</em>
Junio C Hamanofce7c7e2008-07-02 03:06:38452will automatically invoke this command.
Junio C Hamanoe7935c42006-12-13 21:32:17453</p>
454</dd>
Junio C Hamano103b5722011-01-31 05:03:45455<dt class="hdlist1">
Junio C Hamano3e3aa812010-07-05 23:25:23456<em>forget</em> &lt;pathspec&gt;
457</dt>
458<dd>
459<p>
460This resets the conflict resolutions which rerere has recorded for the current
Junio C Hamanod2c978f2011-03-20 19:42:22461conflict in &lt;pathspec&gt;.
Junio C Hamano3e3aa812010-07-05 23:25:23462</p>
463</dd>
Junio C Hamano103b5722011-01-31 05:03:45464<dt class="hdlist1">
Junio C Hamanoe7935c42006-12-13 21:32:17465<em>diff</em>
466</dt>
467<dd>
468<p>
469This displays diffs for the current state of the resolution. It is
470useful for tracking what has changed while the user is resolving
471conflicts. Additional arguments are passed directly to the system
Junio C Hamanoba4b9282008-07-06 05:20:31472<em>diff</em> command installed in PATH.
Junio C Hamanoe7935c42006-12-13 21:32:17473</p>
474</dd>
Junio C Hamano103b5722011-01-31 05:03:45475<dt class="hdlist1">
Junio C Hamanoe7935c42006-12-13 21:32:17476<em>status</em>
477</dt>
478<dd>
479<p>
Junio C Hamanoba4b9282008-07-06 05:20:31480Like <em>diff</em>, but this only prints the filenames that will be tracked
Junio C Hamanoe7935c42006-12-13 21:32:17481for resolutions.
482</p>
483</dd>
Junio C Hamano103b5722011-01-31 05:03:45484<dt class="hdlist1">
Junio C Hamanoe7935c42006-12-13 21:32:17485<em>gc</em>
486</dt>
487<dd>
488<p>
Junio C Hamano25e7ba62009-06-14 01:03:22489This prunes records of conflicted merges that
490occurred a long time ago. By default, unresolved conflicts older
491than 15 days and resolved conflicts older than 60
492days are pruned. These defaults are controlled via the
Junio C Hamano74640642006-12-27 10:59:55493<tt>gc.rerereunresolved</tt> and <tt>gc.rerereresolved</tt> configuration
Junio C Hamano25e7ba62009-06-14 01:03:22494variables respectively.
Junio C Hamanoe7935c42006-12-13 21:32:17495</p>
496</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31497</dl></div>
Junio C Hamanoe7935c42006-12-13 21:32:17498</div>
Junio C Hamanoba4b9282008-07-06 05:20:31499<h2 id="_discussion">DISCUSSION</h2>
Junio C Hamano40f2f8d2006-02-07 08:04:39500<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45501<div class="paragraph"><p>When your topic branch modifies an overlapping area that your
Junio C Hamano40f2f8d2006-02-07 08:04:39502master branch (or upstream) touched since your topic branch
503forked from it, you may want to test it with the latest master,
Junio C Hamanoba4b9282008-07-06 05:20:31504even before your topic branch is ready to be pushed upstream:</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39505<div class="listingblock">
506<div class="content">
507<pre><tt> o---*---o topic
508 /
509 o---o---o---*---o---o master</tt></pre>
510</div></div>
Junio C Hamano103b5722011-01-31 05:03:45511<div class="paragraph"><p>For such a test, you need to merge master and topic somehow.
Junio C Hamanoba4b9282008-07-06 05:20:31512One way to do it is to pull master into the topic branch:</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39513<div class="listingblock">
514<div class="content">
515<pre><tt> $ git checkout topic
Junio C Hamanoedd2b0a2007-01-15 06:12:45516 $ git merge master
Junio C Hamano40f2f8d2006-02-07 08:04:39517
518 o---*---o---+ topic
519 / /
520 o---o---o---*---o---o master</tt></pre>
521</div></div>
Junio C Hamano103b5722011-01-31 05:03:45522<div class="paragraph"><p>The commits marked with <tt>*</tt> touch the same area in the same
Junio C Hamano40f2f8d2006-02-07 08:04:39523file; you need to resolve the conflicts when creating the commit
Junio C Hamanofaa1e502008-08-10 03:55:58524marked with <tt>&#43;</tt>. Then you can test the result to make sure your
Junio C Hamanoba4b9282008-07-06 05:20:31525work-in-progress still works with what is in the latest master.</p></div>
Junio C Hamano103b5722011-01-31 05:03:45526<div class="paragraph"><p>After this test merge, there are two ways to continue your work
Junio C Hamano40f2f8d2006-02-07 08:04:39527on the topic. The easiest is to build on top of the test merge
Junio C Hamanofaa1e502008-08-10 03:55:58528commit <tt>&#43;</tt>, and when your work in the topic branch is finally
Junio C Hamano40f2f8d2006-02-07 08:04:39529ready, pull the topic branch into master, and/or ask the
530upstream to pull from you. By that time, however, the master or
Junio C Hamanofaa1e502008-08-10 03:55:58531the upstream might have been advanced since the test merge <tt>&#43;</tt>,
Junio C Hamanoba4b9282008-07-06 05:20:31532in which case the final commit graph would look like this:</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39533<div class="listingblock">
534<div class="content">
535<pre><tt> $ git checkout topic
Junio C Hamanoedd2b0a2007-01-15 06:12:45536 $ git merge master
Junio C Hamano40f2f8d2006-02-07 08:04:39537 $ ... work on both topic and master branches
538 $ git checkout master
Junio C Hamanoedd2b0a2007-01-15 06:12:45539 $ git merge topic
Junio C Hamano40f2f8d2006-02-07 08:04:39540
541 o---*---o---+---o---o topic
542 / / \
543 o---o---o---*---o---o---o---o---+ master</tt></pre>
544</div></div>
Junio C Hamano103b5722011-01-31 05:03:45545<div class="paragraph"><p>When your topic branch is long-lived, however, your topic branch
Junio C Hamano40f2f8d2006-02-07 08:04:39546would end up having many such "Merge from master" commits on it,
547which would unnecessarily clutter the development history.
548Readers of the Linux kernel mailing list may remember that Linus
549complained about such too frequent test merges when a subsystem
Junio C Hamanoba4b9282008-07-06 05:20:31550maintainer asked to pull from a branch full of "useless merges".</p></div>
Junio C Hamano103b5722011-01-31 05:03:45551<div class="paragraph"><p>As an alternative, to keep the topic branch clean of test
Junio C Hamano40f2f8d2006-02-07 08:04:39552merges, you could blow away the test merge, and keep building on
Junio C Hamanoba4b9282008-07-06 05:20:31553top of the tip before the test merge:</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39554<div class="listingblock">
555<div class="content">
556<pre><tt> $ git checkout topic
Junio C Hamanoedd2b0a2007-01-15 06:12:45557 $ git merge master
Junio C Hamano40f2f8d2006-02-07 08:04:39558 $ git reset --hard HEAD^ ;# rewind the test merge
559 $ ... work on both topic and master branches
560 $ git checkout master
Junio C Hamanoedd2b0a2007-01-15 06:12:45561 $ git merge topic
Junio C Hamano40f2f8d2006-02-07 08:04:39562
563 o---*---o-------o---o topic
564 / \
565 o---o---o---*---o---o---o---o---+ master</tt></pre>
566</div></div>
Junio C Hamano103b5722011-01-31 05:03:45567<div class="paragraph"><p>This would leave only one merge commit when your topic branch is
Junio C Hamano40f2f8d2006-02-07 08:04:39568finally ready and merged into the master branch. This merge
569would require you to resolve the conflict, introduced by the
Junio C Hamano25e7ba62009-06-14 01:03:22570commits marked with <tt>*</tt>. However, this conflict is often the
Junio C Hamano40f2f8d2006-02-07 08:04:39571same conflict you resolved when you created the test merge you
Junio C Hamano1aa40d22010-01-21 17:46:43572blew away. <em>git rerere</em> helps you resolve this final
Junio C Hamano40f2f8d2006-02-07 08:04:39573conflicted merge using the information from your earlier hand
Junio C Hamanoba4b9282008-07-06 05:20:31574resolve.</p></div>
Junio C Hamano103b5722011-01-31 05:03:45575<div class="paragraph"><p>Running the <em>git rerere</em> command immediately after a conflicted
Junio C Hamano40f2f8d2006-02-07 08:04:39576automerge records the conflicted working tree files, with the
577usual conflict markers <tt>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</tt>, <tt>=======</tt>, and <tt>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</tt> in
578them. Later, after you are done resolving the conflicts,
Junio C Hamano1aa40d22010-01-21 17:46:43579running <em>git rerere</em> again will record the resolved state of these
Junio C Hamano40f2f8d2006-02-07 08:04:39580files. Suppose you did this when you created the test merge of
Junio C Hamanoba4b9282008-07-06 05:20:31581master into the topic branch.</p></div>
Junio C Hamano103b5722011-01-31 05:03:45582<div class="paragraph"><p>Next time, after seeing the same conflicted automerge,
Junio C Hamano1aa40d22010-01-21 17:46:43583running <em>git rerere</em> will perform a three-way merge between the
Junio C Hamano40f2f8d2006-02-07 08:04:39584earlier conflicted automerge, the earlier manual resolution, and
Junio C Hamano25e7ba62009-06-14 01:03:22585the current conflicted automerge.
Junio C Hamano40f2f8d2006-02-07 08:04:39586If this three-way merge resolves cleanly, the result is written
Junio C Hamano25e7ba62009-06-14 01:03:22587out to your working tree file, so you do not have to manually
Junio C Hamano1aa40d22010-01-21 17:46:43588resolve it. Note that <em>git rerere</em> leaves the index file alone,
Junio C Hamano40f2f8d2006-02-07 08:04:39589so you still need to do the final sanity checks with <tt>git diff</tt>
Junio C Hamano1aa40d22010-01-21 17:46:43590(or <tt>git diff -c</tt>) and <em>git add</em> when you are satisfied.</p></div>
Junio C Hamano103b5722011-01-31 05:03:45591<div class="paragraph"><p>As a convenience measure, <em>git merge</em> automatically invokes
Junio C Hamano1aa40d22010-01-21 17:46:43592<em>git rerere</em> upon exiting with a failed automerge and <em>git rerere</em>
Junio C Hamano25e7ba62009-06-14 01:03:22593records the hand resolve when it is a new conflict, or reuses the earlier hand
Junio C Hamano1aa40d22010-01-21 17:46:43594resolve when it is not. <em>git commit</em> also invokes <em>git rerere</em>
Junio C Hamano25e7ba62009-06-14 01:03:22595when committing a merge result. What this means is that you do
596not have to do anything special yourself (besides enabling
597the rerere.enabled config variable).</p></div>
Junio C Hamano103b5722011-01-31 05:03:45598<div class="paragraph"><p>In our example, when you do the test merge, the manual
Junio C Hamano40f2f8d2006-02-07 08:04:39599resolution is recorded, and it will be reused when you do the
Junio C Hamano25e7ba62009-06-14 01:03:22600actual merge later with the updated master and topic branch, as long
601as the recorded resolution is still applicable.</p></div>
Junio C Hamano103b5722011-01-31 05:03:45602<div class="paragraph"><p>The information <em>git rerere</em> records is also used when running
Junio C Hamano1aa40d22010-01-21 17:46:43603<em>git rebase</em>. After blowing away the test merge and continuing
Junio C Hamanoba4b9282008-07-06 05:20:31604development on the topic branch:</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39605<div class="listingblock">
606<div class="content">
607<pre><tt> o---*---o-------o---o topic
608 /
609 o---o---o---*---o---o---o---o master
610
611 $ git rebase master topic
612
613 o---*---o-------o---o topic
614 /
615 o---o---o---*---o---o---o---o master</tt></pre>
616</div></div>
Junio C Hamano103b5722011-01-31 05:03:45617<div class="paragraph"><p>you could run <tt>git rebase master topic</tt>, to bring yourself
Junio C Hamano25e7ba62009-06-14 01:03:22618up-to-date before your topic is ready to be sent upstream.
619This would result in falling back to a three-way merge, and it
620would conflict the same way as the test merge you resolved earlier.
Junio C Hamano1aa40d22010-01-21 17:46:43621<em>git rerere</em> will be run by <em>git rebase</em> to help you resolve this
Junio C Hamanoba4b9282008-07-06 05:20:31622conflict.</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39623</div>
Junio C Hamanoba4b9282008-07-06 05:20:31624<h2 id="_git">GIT</h2>
Junio C Hamano40f2f8d2006-02-07 08:04:39625<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45626<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39627</div>
628<div id="footer">
629<div id="footer-text">
Junio C Hamanod2c978f2011-03-20 19:42:22630Last updated 2011-03-20 19:41:42 UTC
Junio C Hamano40f2f8d2006-02-07 08:04:39631</div>
632</div>
633</body>
634</html>