| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 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" /> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 8.2.5" /> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 7 | <style type="text/css"> | 
|  | 8 | /* Debug borders */ | 
|  | 9 | p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { | 
|  | 10 | /* | 
|  | 11 | border: 1px solid red; | 
|  | 12 | */ | 
|  | 13 | } | 
|  | 14 |  | 
|  | 15 | body { | 
|  | 16 | margin: 1em 5% 1em 5%; | 
|  | 17 | } | 
|  | 18 |  | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 19 | a { | 
|  | 20 | color: blue; | 
|  | 21 | text-decoration: underline; | 
|  | 22 | } | 
|  | 23 | a:visited { | 
|  | 24 | color: fuchsia; | 
|  | 25 | } | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 26 |  | 
|  | 27 | em { | 
|  | 28 | font-style: italic; | 
|  | 29 | } | 
|  | 30 |  | 
|  | 31 | strong { | 
|  | 32 | font-weight: bold; | 
|  | 33 | } | 
|  | 34 |  | 
|  | 35 | tt { | 
|  | 36 | color: navy; | 
|  | 37 | } | 
|  | 38 |  | 
|  | 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; | 
|  | 45 | } | 
|  | 46 |  | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 47 | h1, h2, h3 { | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 48 | border-bottom: 2px solid silver; | 
|  | 49 | } | 
|  | 50 | h2 { | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 51 | padding-top: 0.5em; | 
|  | 52 | } | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 53 | h3 { | 
|  | 54 | float: left; | 
|  | 55 | } | 
|  | 56 | h3 + * { | 
|  | 57 | clear: left; | 
|  | 58 | } | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 59 |  | 
|  | 60 | div.sectionbody { | 
|  | 61 | font-family: serif; | 
|  | 62 | margin-left: 0; | 
|  | 63 | } | 
|  | 64 |  | 
|  | 65 | hr { | 
|  | 66 | border: 1px solid silver; | 
|  | 67 | } | 
|  | 68 |  | 
|  | 69 | p { | 
|  | 70 | margin-top: 0.5em; | 
|  | 71 | margin-bottom: 0.5em; | 
|  | 72 | } | 
|  | 73 |  | 
|  | 74 | pre { | 
|  | 75 | padding: 0; | 
|  | 76 | margin: 0; | 
|  | 77 | } | 
|  | 78 |  | 
|  | 79 | span#author { | 
|  | 80 | color: #527bbd; | 
|  | 81 | font-family: sans-serif; | 
|  | 82 | font-weight: bold; | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 83 | font-size: 1.1em; | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 84 | } | 
|  | 85 | span#email { | 
|  | 86 | } | 
|  | 87 | span#revision { | 
|  | 88 | font-family: sans-serif; | 
|  | 89 | } | 
|  | 90 |  | 
|  | 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; | 
|  | 97 | } | 
|  | 98 | div#footer-text { | 
|  | 99 | float: left; | 
|  | 100 | padding-bottom: 0.5em; | 
|  | 101 | } | 
|  | 102 | div#footer-badges { | 
|  | 103 | float: right; | 
|  | 104 | padding-bottom: 0.5em; | 
|  | 105 | } | 
|  | 106 |  | 
|  | 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; | 
|  | 114 | } | 
|  | 115 | div.admonitionblock { | 
|  | 116 | margin-top: 2.5em; | 
|  | 117 | margin-bottom: 2.5em; | 
|  | 118 | } | 
|  | 119 |  | 
|  | 120 | div.content { /* Block element content. */ | 
|  | 121 | padding: 0; | 
|  | 122 | } | 
|  | 123 |  | 
|  | 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; | 
|  | 131 | } | 
|  | 132 | div.title + * { | 
|  | 133 | margin-top: 0; | 
|  | 134 | } | 
|  | 135 |  | 
|  | 136 | td div.title:first-child { | 
|  | 137 | margin-top: 0.0em; | 
|  | 138 | } | 
|  | 139 | div.content div.title:first-child { | 
|  | 140 | margin-top: 0.0em; | 
|  | 141 | } | 
|  | 142 | div.content + div.title { | 
|  | 143 | margin-top: 0.0em; | 
|  | 144 | } | 
|  | 145 |  | 
|  | 146 | div.sidebarblock > div.content { | 
|  | 147 | background: #ffffee; | 
|  | 148 | border: 1px solid silver; | 
|  | 149 | padding: 0.5em; | 
|  | 150 | } | 
|  | 151 |  | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 152 | div.listingblock { | 
|  | 153 | margin-right: 0%; | 
|  | 154 | } | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 155 | div.listingblock > div.content { | 
|  | 156 | border: 1px solid silver; | 
|  | 157 | background: #f4f4f4; | 
|  | 158 | padding: 0.5em; | 
|  | 159 | } | 
|  | 160 |  | 
|  | 161 | div.quoteblock > div.content { | 
|  | 162 | padding-left: 2.0em; | 
|  | 163 | } | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 164 |  | 
|  | 165 | div.attribution { | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 166 | text-align: right; | 
|  | 167 | } | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 168 | div.verseblock + div.attribution { | 
|  | 169 | text-align: left; | 
|  | 170 | } | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 171 |  | 
|  | 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; | 
|  | 179 | } | 
|  | 180 | div.admonitionblock td.content { | 
|  | 181 | padding-left: 0.5em; | 
|  | 182 | border-left: 2px solid silver; | 
|  | 183 | } | 
|  | 184 |  | 
|  | 185 | div.exampleblock > div.content { | 
|  | 186 | border-left: 2px solid silver; | 
|  | 187 | padding: 0.5em; | 
|  | 188 | } | 
|  | 189 |  | 
|  | 190 | div.verseblock div.content { | 
|  | 191 | white-space: pre; | 
|  | 192 | } | 
|  | 193 |  | 
|  | 194 | div.imageblock div.content { padding-left: 0; } | 
|  | 195 | div.imageblock img { border: 1px solid silver; } | 
|  | 196 | span.image img { border-style: none; } | 
|  | 197 |  | 
|  | 198 | dl { | 
|  | 199 | margin-top: 0.8em; | 
|  | 200 | margin-bottom: 0.8em; | 
|  | 201 | } | 
|  | 202 | dt { | 
|  | 203 | margin-top: 0.5em; | 
|  | 204 | margin-bottom: 0; | 
|  | 205 | font-style: italic; | 
|  | 206 | } | 
|  | 207 | dd > *:first-child { | 
|  | 208 | margin-top: 0; | 
|  | 209 | } | 
|  | 210 |  | 
|  | 211 | ul, ol { | 
|  | 212 | list-style-position: outside; | 
|  | 213 | } | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 214 | div.olist2 ol { | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 215 | list-style-type: lower-alpha; | 
|  | 216 | } | 
|  | 217 |  | 
|  | 218 | div.tableblock > table { | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 219 | border: 3px solid #527bbd; | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 220 | } | 
|  | 221 | thead { | 
|  | 222 | font-family: sans-serif; | 
|  | 223 | font-weight: bold; | 
|  | 224 | } | 
|  | 225 | tfoot { | 
|  | 226 | font-weight: bold; | 
|  | 227 | } | 
|  | 228 |  | 
|  | 229 | div.hlist { | 
|  | 230 | margin-top: 0.8em; | 
|  | 231 | margin-bottom: 0.8em; | 
|  | 232 | } | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 233 | div.hlist td { | 
|  | 234 | padding-bottom: 5px; | 
|  | 235 | } | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 236 | td.hlist1 { | 
|  | 237 | vertical-align: top; | 
|  | 238 | font-style: italic; | 
|  | 239 | padding-right: 0.8em; | 
|  | 240 | } | 
|  | 241 | td.hlist2 { | 
|  | 242 | vertical-align: top; | 
|  | 243 | } | 
|  | 244 |  | 
|  | 245 | @media print { | 
|  | 246 | div#footer-badges { display: none; } | 
|  | 247 | } | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 248 |  | 
|  | 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; | 
|  | 256 | } | 
|  | 257 |  | 
|  | 258 | div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { | 
|  | 259 | margin-top: 0; | 
|  | 260 | margin-bottom: 0; | 
|  | 261 | } | 
|  | 262 | div.toclevel2 { | 
|  | 263 | margin-left: 2em; | 
|  | 264 | font-size: 0.9em; | 
|  | 265 | } | 
|  | 266 | div.toclevel3 { | 
|  | 267 | margin-left: 4em; | 
|  | 268 | font-size: 0.9em; | 
|  | 269 | } | 
|  | 270 | div.toclevel4 { | 
|  | 271 | margin-left: 6em; | 
|  | 272 | font-size: 0.9em; | 
|  | 273 | } | 
|  | 274 | include1::./stylesheets/xhtml11-manpage.css[] | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 275 | /* Workarounds for IE6's broken and incomplete CSS2. */ | 
|  | 276 |  | 
|  | 277 | div.sidebar-content { | 
|  | 278 | background: #ffffee; | 
|  | 279 | border: 1px solid silver; | 
|  | 280 | padding: 0.5em; | 
|  | 281 | } | 
|  | 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; | 
|  | 287 | } | 
|  | 288 |  | 
|  | 289 | div.listingblock div.content { | 
|  | 290 | border: 1px solid silver; | 
|  | 291 | background: #f4f4f4; | 
|  | 292 | padding: 0.5em; | 
|  | 293 | } | 
|  | 294 |  | 
|  | 295 | div.quoteblock-content { | 
|  | 296 | padding-left: 2.0em; | 
|  | 297 | } | 
|  | 298 |  | 
|  | 299 | div.exampleblock-content { | 
|  | 300 | border-left: 2px solid silver; | 
|  | 301 | padding-left: 0.5em; | 
|  | 302 | } | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 303 |  | 
|  | 304 | /* IE6 sets dynamically generated links as visited. */ | 
|  | 305 | div#toc a:visited { color: blue; } | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 306 | </style> | 
|  | 307 | <title>git-rerere(1)</title> | 
|  | 308 | </head> | 
|  | 309 | <body> | 
|  | 310 | <div id="header"> | 
|  | 311 | <h1> | 
|  | 312 | git-rerere(1) Manual Page | 
|  | 313 | </h1> | 
|  | 314 | <h2>NAME</h2> | 
|  | 315 | <div class="sectionbody"> | 
|  | 316 | <p>git-rerere - | 
| Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 317 | Reuse recorded resolution of conflicted merges | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 318 | </p> | 
|  | 319 | </div> | 
|  | 320 | </div> | 
|  | 321 | <h2>SYNOPSIS</h2> | 
|  | 322 | <div class="sectionbody"> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 323 | <div class="para"><p><em>git rerere</em> [<em>clear</em>|<em>diff</em>|<em>status</em>|<em>gc</em>]</p></div> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 324 | </div> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 325 | <h2 id="_description">DESCRIPTION</h2> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 326 | <div class="sectionbody"> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 327 | <div class="para"><p>In a workflow that employs relatively long lived topic branches, | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 328 | the developer sometimes needs to resolve the same conflict over | 
|  | 329 | and over again until the topic branches are done (either merged | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 330 | to 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 Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 332 | automerge results and corresponding hand-resolve results on the | 
|  | 333 | initial manual merge, and later by noticing the same automerge | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 334 | results and applying the previously recorded hand resolution.</p></div> | 
| Junio C Hamano | 0e47b23 | 2008-01-15 08:31:10 | [diff] [blame] | 335 | <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 | 
|  | 341 | enable this command.</td> | 
|  | 342 | </tr></table> | 
|  | 343 | </div> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 344 | </div> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 345 | <h2 id="_commands">COMMANDS</h2> | 
| Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 346 | <div class="sectionbody"> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 347 | <div class="para"><p>Normally, <em>git-rerere</em> is run without arguments or user-intervention. | 
| Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 348 | However, it has several commands that allow it to interact with | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 349 | its working state.</p></div> | 
|  | 350 | <div class="vlist"><dl> | 
| Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 351 | <dt> | 
|  | 352 | <em>clear</em> | 
|  | 353 | </dt> | 
|  | 354 | <dd> | 
|  | 355 | <p> | 
|  | 356 | This resets the metadata used by rerere if a merge resolution is to be | 
| Junio C Hamano | ccc2f76 | 2008-07-24 04:03:33 | [diff] [blame] | 357 | aborted. Calling <em>git-am [--skip|--abort]</em> or <em>git-rebase [--skip|--abort]</em> | 
| Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 358 | will automatically invoke this command. | 
| Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 359 | </p> | 
|  | 360 | </dd> | 
|  | 361 | <dt> | 
|  | 362 | <em>diff</em> | 
|  | 363 | </dt> | 
|  | 364 | <dd> | 
|  | 365 | <p> | 
|  | 366 | This displays diffs for the current state of the resolution. It is | 
|  | 367 | useful for tracking what has changed while the user is resolving | 
|  | 368 | conflicts. Additional arguments are passed directly to the system | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 369 | <em>diff</em> command installed in PATH. | 
| Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 370 | </p> | 
|  | 371 | </dd> | 
|  | 372 | <dt> | 
|  | 373 | <em>status</em> | 
|  | 374 | </dt> | 
|  | 375 | <dd> | 
|  | 376 | <p> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 377 | Like <em>diff</em>, but this only prints the filenames that will be tracked | 
| Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 378 | for resolutions. | 
|  | 379 | </p> | 
|  | 380 | </dd> | 
|  | 381 | <dt> | 
|  | 382 | <em>gc</em> | 
|  | 383 | </dt> | 
|  | 384 | <dd> | 
|  | 385 | <p> | 
|  | 386 | This command is used to prune records of conflicted merge that | 
| Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 387 | occurred long time ago. By default, conflicts older than 15 | 
|  | 388 | days that you have not recorded their resolution, and conflicts | 
|  | 389 | older than 60 days, are pruned. These are controlled with | 
|  | 390 | <tt>gc.rerereunresolved</tt> and <tt>gc.rerereresolved</tt> configuration | 
|  | 391 | variables. | 
| Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 392 | </p> | 
|  | 393 | </dd> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 394 | </dl></div> | 
| Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 395 | </div> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 396 | <h2 id="_discussion">DISCUSSION</h2> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 397 | <div class="sectionbody"> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 398 | <div class="para"><p>When your topic branch modifies overlapping area that your | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 399 | master branch (or upstream) touched since your topic branch | 
|  | 400 | forked from it, you may want to test it with the latest master, | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 401 | even before your topic branch is ready to be pushed upstream:</p></div> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 402 | <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 Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 408 | <div class="para"><p>For such a test, you need to merge master and topic somehow. | 
|  | 409 | One way to do it is to pull master into the topic branch:</p></div> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 410 | <div class="listingblock"> | 
|  | 411 | <div class="content"> | 
|  | 412 | <pre><tt> $ git checkout topic | 
| Junio C Hamano | edd2b0a | 2007-01-15 06:12:45 | [diff] [blame] | 413 | $ git merge master | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 414 |  | 
|  | 415 | o---*---o---+ topic | 
|  | 416 | / / | 
|  | 417 | o---o---o---*---o---o master</tt></pre> | 
|  | 418 | </div></div> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 419 | <div class="para"><p>The commits marked with <tt>*</tt> touch the same area in the same | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 420 | file; you need to resolve the conflicts when creating the commit | 
| Junio C Hamano | faa1e50 | 2008-08-10 03:55:58 | [diff] [blame] | 421 | marked with <tt>+</tt>. Then you can test the result to make sure your | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 422 | work-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 Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 424 | on the topic. The easiest is to build on top of the test merge | 
| Junio C Hamano | faa1e50 | 2008-08-10 03:55:58 | [diff] [blame] | 425 | commit <tt>+</tt>, and when your work in the topic branch is finally | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 426 | ready, pull the topic branch into master, and/or ask the | 
|  | 427 | upstream to pull from you. By that time, however, the master or | 
| Junio C Hamano | faa1e50 | 2008-08-10 03:55:58 | [diff] [blame] | 428 | the upstream might have been advanced since the test merge <tt>+</tt>, | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 429 | in which case the final commit graph would look like this:</p></div> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 430 | <div class="listingblock"> | 
|  | 431 | <div class="content"> | 
|  | 432 | <pre><tt> $ git checkout topic | 
| Junio C Hamano | edd2b0a | 2007-01-15 06:12:45 | [diff] [blame] | 433 | $ git merge master | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 434 | $ ... work on both topic and master branches | 
|  | 435 | $ git checkout master | 
| Junio C Hamano | edd2b0a | 2007-01-15 06:12:45 | [diff] [blame] | 436 | $ git merge topic | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 437 |  | 
|  | 438 | o---*---o---+---o---o topic | 
|  | 439 | / / \ | 
|  | 440 | o---o---o---*---o---o---o---o---+ master</tt></pre> | 
|  | 441 | </div></div> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 442 | <div class="para"><p>When your topic branch is long-lived, however, your topic branch | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 443 | would end up having many such "Merge from master" commits on it, | 
|  | 444 | which would unnecessarily clutter the development history. | 
|  | 445 | Readers of the Linux kernel mailing list may remember that Linus | 
|  | 446 | complained about such too frequent test merges when a subsystem | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 447 | maintainer 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 Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 449 | merges, you could blow away the test merge, and keep building on | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 450 | top of the tip before the test merge:</p></div> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 451 | <div class="listingblock"> | 
|  | 452 | <div class="content"> | 
|  | 453 | <pre><tt> $ git checkout topic | 
| Junio C Hamano | edd2b0a | 2007-01-15 06:12:45 | [diff] [blame] | 454 | $ git merge master | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 455 | $ git reset --hard HEAD^ ;# rewind the test merge | 
|  | 456 | $ ... work on both topic and master branches | 
|  | 457 | $ git checkout master | 
| Junio C Hamano | edd2b0a | 2007-01-15 06:12:45 | [diff] [blame] | 458 | $ git merge topic | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 459 |  | 
|  | 460 | o---*---o-------o---o topic | 
|  | 461 | / \ | 
|  | 462 | o---o---o---*---o---o---o---o---+ master</tt></pre> | 
|  | 463 | </div></div> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 464 | <div class="para"><p>This would leave only one merge commit when your topic branch is | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 465 | finally ready and merged into the master branch. This merge | 
|  | 466 | would require you to resolve the conflict, introduced by the | 
|  | 467 | commits marked with <tt>*</tt>. However, often this conflict is the | 
|  | 468 | same conflict you resolved when you created the test merge you | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 469 | blew away. <em>git-rerere</em> command helps you to resolve this final | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 470 | conflicted merge using the information from your earlier hand | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 471 | resolve.</p></div> | 
|  | 472 | <div class="para"><p>Running the <em>git-rerere</em> command immediately after a conflicted | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 473 | automerge records the conflicted working tree files, with the | 
|  | 474 | usual conflict markers <tt><<<<<<<</tt>, <tt>=======</tt>, and <tt>>>>>>>></tt> in | 
|  | 475 | them. Later, after you are done resolving the conflicts, | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 476 | running <em>git-rerere</em> again records the resolved state of these | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 477 | files. Suppose you did this when you created the test merge of | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 478 | master into the topic branch.</p></div> | 
|  | 479 | <div class="para"><p>Next time, running <em>git-rerere</em> after seeing a conflicted | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 480 | automerge, if the conflict is the same as the earlier one | 
|  | 481 | recorded, it is noticed and a three-way merge between the | 
|  | 482 | earlier conflicted automerge, the earlier manual resolution, and | 
|  | 483 | the current conflicted automerge is performed by the command. | 
|  | 484 | If this three-way merge resolves cleanly, the result is written | 
|  | 485 | out to your working tree file, so you would not have to manually | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 486 | resolve it. Note that <em>git-rerere</em> leaves the index file alone, | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 487 | so you still need to do the final sanity checks with <tt>git diff</tt> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 488 | (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 Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 491 | records it if it is a new conflict, or reuses the earlier hand | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 492 | resolve when it is not. <em>git-commit</em> also invokes <em>git-rerere</em> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 493 | when recording a merge result. What this means is that you do | 
|  | 494 | not have to do anything special yourself (Note: you still have | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 495 | to 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 Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 497 | resolution is recorded, and it will be reused when you do the | 
|  | 498 | actual merge later with updated master and topic branch, as long | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 499 | as 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 | 
|  | 502 | development on the topic branch:</p></div> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 503 | <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 Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 515 | <div class="para"><p>you could run <tt>git rebase master topic</tt>, to keep yourself | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 516 | up-to-date even before your topic is ready to be sent upstream. | 
|  | 517 | This would result in falling back to three-way merge, and it | 
|  | 518 | would conflict the same way the test merge you resolved earlier. | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 519 | <em>git-rerere</em> is run by <em>git-rebase</em> to help you resolve this | 
|  | 520 | conflict.</p></div> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 521 | </div> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 522 | <h2 id="_author">Author</h2> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 523 | <div class="sectionbody"> | 
| Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 524 | <div class="para"><p>Written by Junio C Hamano <gitster@pobox.com></p></div> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 525 | </div> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 526 | <h2 id="_git">GIT</h2> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 527 | <div class="sectionbody"> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 528 | <div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div> | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 529 | </div> | 
|  | 530 | <div id="footer"> | 
|  | 531 | <div id="footer-text"> | 
| Junio C Hamano | 9572e92 | 2009-04-02 06:52:03 | [diff] [blame] | 532 | Last updated 2009-04-02 06:50:02 UTC | 
| Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 533 | </div> | 
|  | 534 | </div> | 
|  | 535 | </body> | 
|  | 536 | </html> |