blob: 0be765cc1c9e76f3b99c856179483fcf40dd7cd8 [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 Hamanoba4b9282008-07-06 05:20:316<meta name="generator" content="AsciiDoc 8.2.5" />
Junio C Hamano40f2f8d2006-02-07 08:04:397<style type="text/css">
8/* Debug borders */
9p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
10/*
11 border: 1px solid red;
12*/
13}
14
15body {
16 margin: 1em 5% 1em 5%;
17}
18
Junio C Hamanoba4b9282008-07-06 05:20:3119a {
20 color: blue;
21 text-decoration: underline;
22}
23a:visited {
24 color: fuchsia;
25}
Junio C Hamano40f2f8d2006-02-07 08:04:3926
27em {
28 font-style: italic;
29}
30
31strong {
32 font-weight: bold;
33}
34
35tt {
36 color: navy;
37}
38
39h1, 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;
45}
46
Junio C Hamanoba4b9282008-07-06 05:20:3147h1, h2, h3 {
Junio C Hamano40f2f8d2006-02-07 08:04:3948 border-bottom: 2px solid silver;
49}
50h2 {
Junio C Hamano40f2f8d2006-02-07 08:04:3951 padding-top: 0.5em;
52}
Junio C Hamanoba4b9282008-07-06 05:20:3153h3 {
54 float: left;
55}
56h3 + * {
57 clear: left;
58}
Junio C Hamano40f2f8d2006-02-07 08:04:3959
60div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
63}
64
65hr {
66 border: 1px solid silver;
67}
68
69p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
72}
73
74pre {
75 padding: 0;
76 margin: 0;
77}
78
79span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3183 font-size: 1.1em;
Junio C Hamano40f2f8d2006-02-07 08:04:3984}
85span#email {
86}
87span#revision {
88 font-family: sans-serif;
89}
90
91div#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;
97}
98div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
101}
102div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
105}
106
107div#preamble,
108div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
114}
115div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
118}
119
120div.content { /* Block element content. */
121 padding: 0;
122}
123
124/* Block element titles. */
125div.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;
131}
132div.title + * {
133 margin-top: 0;
134}
135
136td div.title:first-child {
137 margin-top: 0.0em;
138}
139div.content div.title:first-child {
140 margin-top: 0.0em;
141}
142div.content + div.title {
143 margin-top: 0.0em;
144}
145
146div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
150}
151
Junio C Hamanoba4b9282008-07-06 05:20:31152div.listingblock {
153 margin-right: 0%;
154}
Junio C Hamano40f2f8d2006-02-07 08:04:39155div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
159}
160
161div.quoteblock > div.content {
162 padding-left: 2.0em;
163}
Junio C Hamanoba4b9282008-07-06 05:20:31164
165div.attribution {
Junio C Hamano40f2f8d2006-02-07 08:04:39166 text-align: right;
167}
Junio C Hamanoba4b9282008-07-06 05:20:31168div.verseblock + div.attribution {
169 text-align: left;
170}
Junio C Hamano40f2f8d2006-02-07 08:04:39171
172div.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;
179}
180div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
183}
184
185div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
188}
189
190div.verseblock div.content {
191 white-space: pre;
192}
193
194div.imageblock div.content { padding-left: 0; }
195div.imageblock img { border: 1px solid silver; }
196span.image img { border-style: none; }
197
198dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
201}
202dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
206}
207dd > *:first-child {
208 margin-top: 0;
209}
210
211ul, ol {
212 list-style-position: outside;
213}
Junio C Hamanoba4b9282008-07-06 05:20:31214div.olist2 ol {
Junio C Hamano40f2f8d2006-02-07 08:04:39215 list-style-type: lower-alpha;
216}
217
218div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31219 border: 3px solid #527bbd;
Junio C Hamano40f2f8d2006-02-07 08:04:39220}
221thead {
222 font-family: sans-serif;
223 font-weight: bold;
224}
225tfoot {
226 font-weight: bold;
227}
228
229div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
Junio C Hamanoba4b9282008-07-06 05:20:31233div.hlist td {
234 padding-bottom: 5px;
235}
Junio C Hamano40f2f8d2006-02-07 08:04:39236td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
240}
241td.hlist2 {
242 vertical-align: top;
243}
244
245@media print {
246 div#footer-badges { display: none; }
247}
Junio C Hamanoba4b9282008-07-06 05:20:31248
249div#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;
256}
257
258div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
261}
262div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
265}
266div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
269}
270div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
273}
274include1::./stylesheets/xhtml11-manpage.css[]
Junio C Hamano40f2f8d2006-02-07 08:04:39275/* Workarounds for IE6's broken and incomplete CSS2. */
276
277div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
281}
282div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
287}
288
289div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
293}
294
295div.quoteblock-content {
296 padding-left: 2.0em;
297}
298
299div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
302}
Junio C Hamanoba4b9282008-07-06 05:20:31303
304/* IE6 sets dynamically generated links as visited. */
305div#toc a:visited { color: blue; }
Junio C Hamano40f2f8d2006-02-07 08:04:39306</style>
307<title>git-rerere(1)</title>
308</head>
309<body>
310<div id="header">
311<h1>
312git-rerere(1) Manual Page
313</h1>
314<h2>NAME</h2>
315<div class="sectionbody">
316<p>git-rerere -
Junio C Hamano7c73c662007-01-19 00:37:50317 Reuse recorded resolution of conflicted merges
Junio C Hamano40f2f8d2006-02-07 08:04:39318</p>
319</div>
320</div>
321<h2>SYNOPSIS</h2>
322<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31323<div class="para"><p><em>git rerere</em> [<em>clear</em>|<em>diff</em>|<em>status</em>|<em>gc</em>]</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39324</div>
Junio C Hamanoba4b9282008-07-06 05:20:31325<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano40f2f8d2006-02-07 08:04:39326<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31327<div class="para"><p>In a workflow that employs relatively long lived topic branches,
Junio C Hamano40f2f8d2006-02-07 08:04:39328the developer sometimes needs to resolve the same conflict over
329and over again until the topic branches are done (either merged
Junio C Hamanoba4b9282008-07-06 05:20:31330to the "release" branch, or sent out and accepted upstream).</p></div>
331<div class="para"><p>This command helps this process by recording conflicted
Junio C Hamano40f2f8d2006-02-07 08:04:39332automerge results and corresponding hand-resolve results on the
333initial manual merge, and later by noticing the same automerge
Junio C Hamanoba4b9282008-07-06 05:20:31334results and applying the previously recorded hand resolution.</p></div>
Junio C Hamano0e47b232008-01-15 08:31:10335<div class="admonitionblock">
336<table><tr>
337<td class="icon">
338<div class="title">Note</div>
339</td>
340<td class="content">You need to set the configuration variable rerere.enabled to
341enable this command.</td>
342</tr></table>
343</div>
Junio C Hamano40f2f8d2006-02-07 08:04:39344</div>
Junio C Hamanoba4b9282008-07-06 05:20:31345<h2 id="_commands">COMMANDS</h2>
Junio C Hamanoe7935c42006-12-13 21:32:17346<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31347<div class="para"><p>Normally, <em>git-rerere</em> is run without arguments or user-intervention.
Junio C Hamanoe7935c42006-12-13 21:32:17348However, it has several commands that allow it to interact with
Junio C Hamanoba4b9282008-07-06 05:20:31349its working state.</p></div>
350<div class="vlist"><dl>
Junio C Hamanoe7935c42006-12-13 21:32:17351<dt>
352<em>clear</em>
353</dt>
354<dd>
355<p>
356This resets the metadata used by rerere if a merge resolution is to be
Junio C Hamanoccc2f762008-07-24 04:03:33357aborted. Calling <em>git-am [--skip|--abort]</em> or <em>git-rebase [--skip|--abort]</em>
Junio C Hamanofce7c7e2008-07-02 03:06:38358will automatically invoke this command.
Junio C Hamanoe7935c42006-12-13 21:32:17359</p>
360</dd>
361<dt>
362<em>diff</em>
363</dt>
364<dd>
365<p>
366This displays diffs for the current state of the resolution. It is
367useful for tracking what has changed while the user is resolving
368conflicts. Additional arguments are passed directly to the system
Junio C Hamanoba4b9282008-07-06 05:20:31369<em>diff</em> command installed in PATH.
Junio C Hamanoe7935c42006-12-13 21:32:17370</p>
371</dd>
372<dt>
373<em>status</em>
374</dt>
375<dd>
376<p>
Junio C Hamanoba4b9282008-07-06 05:20:31377Like <em>diff</em>, but this only prints the filenames that will be tracked
Junio C Hamanoe7935c42006-12-13 21:32:17378for resolutions.
379</p>
380</dd>
381<dt>
382<em>gc</em>
383</dt>
384<dd>
385<p>
386This command is used to prune records of conflicted merge that
Junio C Hamano74640642006-12-27 10:59:55387occurred long time ago. By default, conflicts older than 15
388days that you have not recorded their resolution, and conflicts
389older than 60 days, are pruned. These are controlled with
390<tt>gc.rerereunresolved</tt> and <tt>gc.rerereresolved</tt> configuration
391variables.
Junio C Hamanoe7935c42006-12-13 21:32:17392</p>
393</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31394</dl></div>
Junio C Hamanoe7935c42006-12-13 21:32:17395</div>
Junio C Hamanoba4b9282008-07-06 05:20:31396<h2 id="_discussion">DISCUSSION</h2>
Junio C Hamano40f2f8d2006-02-07 08:04:39397<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31398<div class="para"><p>When your topic branch modifies overlapping area that your
Junio C Hamano40f2f8d2006-02-07 08:04:39399master branch (or upstream) touched since your topic branch
400forked from it, you may want to test it with the latest master,
Junio C Hamanoba4b9282008-07-06 05:20:31401even before your topic branch is ready to be pushed upstream:</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39402<div class="listingblock">
403<div class="content">
404<pre><tt> o---*---o topic
405 /
406 o---o---o---*---o---o master</tt></pre>
407</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31408<div class="para"><p>For such a test, you need to merge master and topic somehow.
409One way to do it is to pull master into the topic branch:</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39410<div class="listingblock">
411<div class="content">
412<pre><tt> $ git checkout topic
Junio C Hamanoedd2b0a2007-01-15 06:12:45413 $ git merge master
Junio C Hamano40f2f8d2006-02-07 08:04:39414
415 o---*---o---+ topic
416 / /
417 o---o---o---*---o---o master</tt></pre>
418</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31419<div class="para"><p>The commits marked with <tt>*</tt> touch the same area in the same
Junio C Hamano40f2f8d2006-02-07 08:04:39420file; you need to resolve the conflicts when creating the commit
Junio C Hamanofaa1e502008-08-10 03:55:58421marked with <tt>&#43;</tt>. Then you can test the result to make sure your
Junio C Hamanoba4b9282008-07-06 05:20:31422work-in-progress still works with what is in the latest master.</p></div>
423<div class="para"><p>After this test merge, there are two ways to continue your work
Junio C Hamano40f2f8d2006-02-07 08:04:39424on the topic. The easiest is to build on top of the test merge
Junio C Hamanofaa1e502008-08-10 03:55:58425commit <tt>&#43;</tt>, and when your work in the topic branch is finally
Junio C Hamano40f2f8d2006-02-07 08:04:39426ready, pull the topic branch into master, and/or ask the
427upstream to pull from you. By that time, however, the master or
Junio C Hamanofaa1e502008-08-10 03:55:58428the upstream might have been advanced since the test merge <tt>&#43;</tt>,
Junio C Hamanoba4b9282008-07-06 05:20:31429in which case the final commit graph would look like this:</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39430<div class="listingblock">
431<div class="content">
432<pre><tt> $ git checkout topic
Junio C Hamanoedd2b0a2007-01-15 06:12:45433 $ git merge master
Junio C Hamano40f2f8d2006-02-07 08:04:39434 $ ... work on both topic and master branches
435 $ git checkout master
Junio C Hamanoedd2b0a2007-01-15 06:12:45436 $ git merge topic
Junio C Hamano40f2f8d2006-02-07 08:04:39437
438 o---*---o---+---o---o topic
439 / / \
440 o---o---o---*---o---o---o---o---+ master</tt></pre>
441</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31442<div class="para"><p>When your topic branch is long-lived, however, your topic branch
Junio C Hamano40f2f8d2006-02-07 08:04:39443would end up having many such "Merge from master" commits on it,
444which would unnecessarily clutter the development history.
445Readers of the Linux kernel mailing list may remember that Linus
446complained about such too frequent test merges when a subsystem
Junio C Hamanoba4b9282008-07-06 05:20:31447maintainer asked to pull from a branch full of "useless merges".</p></div>
448<div class="para"><p>As an alternative, to keep the topic branch clean of test
Junio C Hamano40f2f8d2006-02-07 08:04:39449merges, you could blow away the test merge, and keep building on
Junio C Hamanoba4b9282008-07-06 05:20:31450top of the tip before the test merge:</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39451<div class="listingblock">
452<div class="content">
453<pre><tt> $ git checkout topic
Junio C Hamanoedd2b0a2007-01-15 06:12:45454 $ git merge master
Junio C Hamano40f2f8d2006-02-07 08:04:39455 $ git reset --hard HEAD^ ;# rewind the test merge
456 $ ... work on both topic and master branches
457 $ git checkout master
Junio C Hamanoedd2b0a2007-01-15 06:12:45458 $ git merge topic
Junio C Hamano40f2f8d2006-02-07 08:04:39459
460 o---*---o-------o---o topic
461 / \
462 o---o---o---*---o---o---o---o---+ master</tt></pre>
463</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31464<div class="para"><p>This would leave only one merge commit when your topic branch is
Junio C Hamano40f2f8d2006-02-07 08:04:39465finally ready and merged into the master branch. This merge
466would require you to resolve the conflict, introduced by the
467commits marked with <tt>*</tt>. However, often this conflict is the
468same conflict you resolved when you created the test merge you
Junio C Hamanoba4b9282008-07-06 05:20:31469blew away. <em>git-rerere</em> command helps you to resolve this final
Junio C Hamano40f2f8d2006-02-07 08:04:39470conflicted merge using the information from your earlier hand
Junio C Hamanoba4b9282008-07-06 05:20:31471resolve.</p></div>
472<div class="para"><p>Running the <em>git-rerere</em> command immediately after a conflicted
Junio C Hamano40f2f8d2006-02-07 08:04:39473automerge records the conflicted working tree files, with the
474usual conflict markers <tt>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</tt>, <tt>=======</tt>, and <tt>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</tt> in
475them. Later, after you are done resolving the conflicts,
Junio C Hamanoba4b9282008-07-06 05:20:31476running <em>git-rerere</em> again records the resolved state of these
Junio C Hamano40f2f8d2006-02-07 08:04:39477files. Suppose you did this when you created the test merge of
Junio C Hamanoba4b9282008-07-06 05:20:31478master into the topic branch.</p></div>
479<div class="para"><p>Next time, running <em>git-rerere</em> after seeing a conflicted
Junio C Hamano40f2f8d2006-02-07 08:04:39480automerge, if the conflict is the same as the earlier one
481recorded, it is noticed and a three-way merge between the
482earlier conflicted automerge, the earlier manual resolution, and
483the current conflicted automerge is performed by the command.
484If this three-way merge resolves cleanly, the result is written
485out to your working tree file, so you would not have to manually
Junio C Hamanoba4b9282008-07-06 05:20:31486resolve it. Note that <em>git-rerere</em> leaves the index file alone,
Junio C Hamano40f2f8d2006-02-07 08:04:39487so you still need to do the final sanity checks with <tt>git diff</tt>
Junio C Hamanoba4b9282008-07-06 05:20:31488(or <tt>git diff -c</tt>) and <em>git-add</em> when you are satisfied.</p></div>
489<div class="para"><p>As a convenience measure, <em>git-merge</em> automatically invokes
490<em>git-rerere</em> when it exits with a failed automerge, which
Junio C Hamano40f2f8d2006-02-07 08:04:39491records it if it is a new conflict, or reuses the earlier hand
Junio C Hamanoba4b9282008-07-06 05:20:31492resolve when it is not. <em>git-commit</em> also invokes <em>git-rerere</em>
Junio C Hamano40f2f8d2006-02-07 08:04:39493when recording a merge result. What this means is that you do
494not have to do anything special yourself (Note: you still have
Junio C Hamanoba4b9282008-07-06 05:20:31495to set the config variable rerere.enabled to enable this command).</p></div>
496<div class="para"><p>In our example, when you did the test merge, the manual
Junio C Hamano40f2f8d2006-02-07 08:04:39497resolution is recorded, and it will be reused when you do the
498actual merge later with updated master and topic branch, as long
Junio C Hamanoba4b9282008-07-06 05:20:31499as the earlier resolution is still applicable.</p></div>
500<div class="para"><p>The information <em>git-rerere</em> records is also used when running
501<em>git-rebase</em>. After blowing away the test merge and continuing
502development on the topic branch:</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39503<div class="listingblock">
504<div class="content">
505<pre><tt> o---*---o-------o---o topic
506 /
507 o---o---o---*---o---o---o---o master
508
509 $ git rebase master topic
510
511 o---*---o-------o---o topic
512 /
513 o---o---o---*---o---o---o---o master</tt></pre>
514</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31515<div class="para"><p>you could run <tt>git rebase master topic</tt>, to keep yourself
Junio C Hamano40f2f8d2006-02-07 08:04:39516up-to-date even before your topic is ready to be sent upstream.
517This would result in falling back to three-way merge, and it
518would conflict the same way the test merge you resolved earlier.
Junio C Hamanoba4b9282008-07-06 05:20:31519<em>git-rerere</em> is run by <em>git-rebase</em> to help you resolve this
520conflict.</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39521</div>
Junio C Hamanoba4b9282008-07-06 05:20:31522<h2 id="_author">Author</h2>
Junio C Hamano40f2f8d2006-02-07 08:04:39523<div class="sectionbody">
Junio C Hamano0868a302008-07-22 09:20:44524<div class="para"><p>Written by Junio C Hamano &lt;gitster@pobox.com&gt;</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39525</div>
Junio C Hamanoba4b9282008-07-06 05:20:31526<h2 id="_git">GIT</h2>
Junio C Hamano40f2f8d2006-02-07 08:04:39527<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31528<div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39529</div>
530<div id="footer">
531<div id="footer-text">
Junio C Hamano6f1bbb72008-10-31 11:32:55532Last updated 2008-10-31 11:28:48 UTC
Junio C Hamano40f2f8d2006-02-07 08:04:39533</div>
534</div>
535</body>
536</html>