blob: 3fb97e78a650696f7340938a3f4e8072a058fbb9 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
Junio C Hamano9d971152012-12-19 00:43:115<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
6<meta name="generator" content="AsciiDoc 8.6.8" />
Junio C Hamano68cf15a2010-11-06 01:01:597<title>git-rebase(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:238<style type="text/css">
Junio C Hamano9d971152012-12-19 00:43:119/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
10
11/* Default font. */
12body {
13 font-family: Georgia,serif;
14}
15
16/* Title font. */
17h1, h2, h3, h4, h5, h6,
18div.title, caption.title,
19thead, p.table.header,
20#toctitle,
21#author, #revnumber, #revdate, #revremark,
22#footer {
23 font-family: Arial,Helvetica,sans-serif;
Junio C Hamano1a4e8412005-12-27 08:17:2324}
25
26body {
27 margin: 1em 5% 1em 5%;
28}
29
Junio C Hamanoba4b9282008-07-06 05:20:3130a {
31 color: blue;
32 text-decoration: underline;
33}
34a:visited {
35 color: fuchsia;
36}
Junio C Hamano1a4e8412005-12-27 08:17:2337
38em {
39 font-style: italic;
Junio C Hamano68cf15a2010-11-06 01:01:5940 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2341}
42
43strong {
44 font-weight: bold;
Junio C Hamano68cf15a2010-11-06 01:01:5945 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2346}
47
Junio C Hamano1a4e8412005-12-27 08:17:2348h1, h2, h3, h4, h5, h6 {
49 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:2350 margin-top: 1.2em;
51 margin-bottom: 0.5em;
52 line-height: 1.3;
53}
54
Junio C Hamanoba4b9282008-07-06 05:20:3155h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2356 border-bottom: 2px solid silver;
57}
58h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2359 padding-top: 0.5em;
60}
Junio C Hamanoba4b9282008-07-06 05:20:3161h3 {
62 float: left;
63}
64h3 + * {
65 clear: left;
66}
Junio C Hamano9d971152012-12-19 00:43:1167h5 {
68 font-size: 1.0em;
69}
Junio C Hamano1a4e8412005-12-27 08:17:2370
71div.sectionbody {
Junio C Hamano1a4e8412005-12-27 08:17:2372 margin-left: 0;
73}
74
75hr {
76 border: 1px solid silver;
77}
78
79p {
80 margin-top: 0.5em;
81 margin-bottom: 0.5em;
82}
83
Junio C Hamano68cf15a2010-11-06 01:01:5984ul, ol, li > p {
85 margin-top: 0;
86}
Junio C Hamano9d971152012-12-19 00:43:1187ul > li { color: #aaa; }
88ul > li > * { color: black; }
Junio C Hamano68cf15a2010-11-06 01:01:5989
Junio C Hamano9d971152012-12-19 00:43:1190.monospaced, code, pre {
91 font-family: "Courier New", Courier, monospace;
92 font-size: inherit;
93 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2394 padding: 0;
95 margin: 0;
96}
97
Junio C Hamano9d971152012-12-19 00:43:1198
99#author {
Junio C Hamano1a4e8412005-12-27 08:17:23100 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23101 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:31102 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23103}
Junio C Hamano9d971152012-12-19 00:43:11104#email {
Junio C Hamano1a4e8412005-12-27 08:17:23105}
Junio C Hamano9d971152012-12-19 00:43:11106#revnumber, #revdate, #revremark {
Junio C Hamano1a4e8412005-12-27 08:17:23107}
108
Junio C Hamano9d971152012-12-19 00:43:11109#footer {
Junio C Hamano1a4e8412005-12-27 08:17:23110 font-size: small;
111 border-top: 2px solid silver;
112 padding-top: 0.5em;
113 margin-top: 4.0em;
114}
Junio C Hamano9d971152012-12-19 00:43:11115#footer-text {
Junio C Hamano1a4e8412005-12-27 08:17:23116 float: left;
117 padding-bottom: 0.5em;
118}
Junio C Hamano9d971152012-12-19 00:43:11119#footer-badges {
Junio C Hamano1a4e8412005-12-27 08:17:23120 float: right;
121 padding-bottom: 0.5em;
122}
123
Junio C Hamano9d971152012-12-19 00:43:11124#preamble {
Junio C Hamano68cf15a2010-11-06 01:01:59125 margin-top: 1.5em;
126 margin-bottom: 1.5em;
127}
Junio C Hamano9d971152012-12-19 00:43:11128div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamano1a4e8412005-12-27 08:17:23129div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
130div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22131 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23132 margin-bottom: 1.5em;
133}
134div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22135 margin-top: 2.0em;
136 margin-bottom: 2.0em;
137 margin-right: 10%;
138 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23139}
140
141div.content { /* Block element content. */
142 padding: 0;
143}
144
145/* Block element titles. */
146div.title, caption.title {
Junio C Hamano68cf15a2010-11-06 01:01:59147 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23148 font-weight: bold;
149 text-align: left;
150 margin-top: 1.0em;
151 margin-bottom: 0.5em;
152}
153div.title + * {
154 margin-top: 0;
155}
156
157td div.title:first-child {
158 margin-top: 0.0em;
159}
160div.content div.title:first-child {
161 margin-top: 0.0em;
162}
163div.content + div.title {
164 margin-top: 0.0em;
165}
166
167div.sidebarblock > div.content {
168 background: #ffffee;
Junio C Hamano9d971152012-12-19 00:43:11169 border: 1px solid #dddddd;
170 border-left: 4px solid #f0f0f0;
Junio C Hamano1a4e8412005-12-27 08:17:23171 padding: 0.5em;
172}
173
174div.listingblock > div.content {
Junio C Hamano9d971152012-12-19 00:43:11175 border: 1px solid #dddddd;
176 border-left: 5px solid #f0f0f0;
177 background: #f8f8f8;
Junio C Hamano1a4e8412005-12-27 08:17:23178 padding: 0.5em;
179}
180
Junio C Hamano7bd050f2011-09-22 06:32:22181div.quoteblock, div.verseblock {
182 padding-left: 1.0em;
183 margin-left: 1.0em;
Junio C Hamano68cf15a2010-11-06 01:01:59184 margin-right: 10%;
Junio C Hamano9d971152012-12-19 00:43:11185 border-left: 5px solid #f0f0f0;
186 color: #888;
Junio C Hamano1a4e8412005-12-27 08:17:23187}
Junio C Hamano7bd050f2011-09-22 06:32:22188
Junio C Hamano68cf15a2010-11-06 01:01:59189div.quoteblock > div.attribution {
190 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23191 text-align: right;
192}
Junio C Hamano68cf15a2010-11-06 01:01:59193
Junio C Hamano9d971152012-12-19 00:43:11194div.verseblock > pre.content {
195 font-family: inherit;
196 font-size: inherit;
Junio C Hamano68cf15a2010-11-06 01:01:59197}
198div.verseblock > div.attribution {
199 padding-top: 0.75em;
200 text-align: left;
201}
202/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31203div.verseblock + div.attribution {
204 text-align: left;
205}
Junio C Hamano1a4e8412005-12-27 08:17:23206
207div.admonitionblock .icon {
208 vertical-align: top;
209 font-size: 1.1em;
210 font-weight: bold;
211 text-decoration: underline;
212 color: #527bbd;
213 padding-right: 0.5em;
214}
215div.admonitionblock td.content {
216 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22217 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23218}
219
220div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22221 border-left: 3px solid #dddddd;
222 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23223}
224
Junio C Hamano1a4e8412005-12-27 08:17:23225div.imageblock div.content { padding-left: 0; }
Junio C Hamano1a4e8412005-12-27 08:17:23226span.image img { border-style: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59227a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23228
229dl {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
233dt {
234 margin-top: 0.5em;
235 margin-bottom: 0;
Junio C Hamano68cf15a2010-11-06 01:01:59236 font-style: normal;
237 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23238}
239dd > *:first-child {
Junio C Hamano68cf15a2010-11-06 01:01:59240 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23241}
242
243ul, ol {
244 list-style-position: outside;
245}
Junio C Hamano68cf15a2010-11-06 01:01:59246ol.arabic {
247 list-style-type: decimal;
248}
249ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23250 list-style-type: lower-alpha;
251}
Junio C Hamano68cf15a2010-11-06 01:01:59252ol.upperalpha {
253 list-style-type: upper-alpha;
254}
255ol.lowerroman {
256 list-style-type: lower-roman;
257}
258ol.upperroman {
259 list-style-type: upper-roman;
260}
261
262div.compact ul, div.compact ol,
263div.compact p, div.compact p,
264div.compact div, div.compact div {
265 margin-top: 0.1em;
266 margin-bottom: 0.1em;
267}
Junio C Hamano1a4e8412005-12-27 08:17:23268
Junio C Hamano1a4e8412005-12-27 08:17:23269tfoot {
270 font-weight: bold;
271}
Junio C Hamano68cf15a2010-11-06 01:01:59272td > div.verse {
273 white-space: pre;
274}
Junio C Hamano68cf15a2010-11-06 01:01:59275
276div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23277 margin-top: 0.8em;
278 margin-bottom: 0.8em;
279}
Junio C Hamano68cf15a2010-11-06 01:01:59280div.hdlist tr {
281 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31282}
Junio C Hamano68cf15a2010-11-06 01:01:59283dt.hdlist1.strong, td.hdlist1.strong {
284 font-weight: bold;
285}
286td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23287 vertical-align: top;
Junio C Hamano68cf15a2010-11-06 01:01:59288 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23289 padding-right: 0.8em;
Junio C Hamano68cf15a2010-11-06 01:01:59290 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23291}
Junio C Hamano68cf15a2010-11-06 01:01:59292td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23293 vertical-align: top;
294}
Junio C Hamano68cf15a2010-11-06 01:01:59295div.hdlist.compact tr {
296 margin: 0;
297 padding-bottom: 0;
298}
299
300.comment {
301 background: yellow;
302}
Junio C Hamano1a4e8412005-12-27 08:17:23303
Junio C Hamano7bd050f2011-09-22 06:32:22304.footnote, .footnoteref {
305 font-size: 0.8em;
306}
307
308span.footnote, span.footnoteref {
309 vertical-align: super;
310}
311
312#footnotes {
313 margin: 20px 0 20px 0;
314 padding: 7px 0 0 0;
315}
316
317#footnotes div.footnote {
318 margin: 0 0 5px 0;
319}
320
321#footnotes hr {
322 border: none;
323 border-top: 1px solid silver;
324 height: 1px;
325 text-align: left;
326 margin-left: 0;
327 width: 20%;
328 min-width: 100px;
329}
330
Junio C Hamano9d971152012-12-19 00:43:11331div.colist td {
332 padding-right: 0.5em;
333 padding-bottom: 0.3em;
334 vertical-align: top;
335}
336div.colist td img {
337 margin-top: 0.3em;
Junio C Hamano1a4e8412005-12-27 08:17:23338}
Junio C Hamanoba4b9282008-07-06 05:20:31339
Junio C Hamano9d971152012-12-19 00:43:11340@media print {
341 #footer-badges { display: none; }
342}
343
344#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22345 margin-bottom: 2.5em;
346}
347
Junio C Hamano9d971152012-12-19 00:43:11348#toctitle {
Junio C Hamanoba4b9282008-07-06 05:20:31349 color: #527bbd;
Junio C Hamanoba4b9282008-07-06 05:20:31350 font-size: 1.1em;
351 font-weight: bold;
352 margin-top: 1.0em;
353 margin-bottom: 0.1em;
354}
355
Junio C Hamano9d971152012-12-19 00:43:11356div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamanoba4b9282008-07-06 05:20:31357 margin-top: 0;
358 margin-bottom: 0;
359}
360div.toclevel2 {
361 margin-left: 2em;
362 font-size: 0.9em;
363}
364div.toclevel3 {
365 margin-left: 4em;
366 font-size: 0.9em;
367}
368div.toclevel4 {
369 margin-left: 6em;
370 font-size: 0.9em;
371}
Junio C Hamano9d971152012-12-19 00:43:11372
373span.aqua { color: aqua; }
374span.black { color: black; }
375span.blue { color: blue; }
376span.fuchsia { color: fuchsia; }
377span.gray { color: gray; }
378span.green { color: green; }
379span.lime { color: lime; }
380span.maroon { color: maroon; }
381span.navy { color: navy; }
382span.olive { color: olive; }
383span.purple { color: purple; }
384span.red { color: red; }
385span.silver { color: silver; }
386span.teal { color: teal; }
387span.white { color: white; }
388span.yellow { color: yellow; }
389
390span.aqua-background { background: aqua; }
391span.black-background { background: black; }
392span.blue-background { background: blue; }
393span.fuchsia-background { background: fuchsia; }
394span.gray-background { background: gray; }
395span.green-background { background: green; }
396span.lime-background { background: lime; }
397span.maroon-background { background: maroon; }
398span.navy-background { background: navy; }
399span.olive-background { background: olive; }
400span.purple-background { background: purple; }
401span.red-background { background: red; }
402span.silver-background { background: silver; }
403span.teal-background { background: teal; }
404span.white-background { background: white; }
405span.yellow-background { background: yellow; }
406
407span.big { font-size: 2em; }
408span.small { font-size: 0.6em; }
409
410span.underline { text-decoration: underline; }
411span.overline { text-decoration: overline; }
412span.line-through { text-decoration: line-through; }
413
414div.unbreakable { page-break-inside: avoid; }
415
416
417/*
418 * xhtml11 specific
419 *
420 * */
421
422div.tableblock {
423 margin-top: 1.0em;
424 margin-bottom: 1.5em;
425}
426div.tableblock > table {
427 border: 3px solid #527bbd;
428}
429thead, p.table.header {
430 font-weight: bold;
431 color: #527bbd;
432}
433p.table {
434 margin-top: 0;
435}
436/* Because the table frame attribute is overriden by CSS in most browsers. */
437div.tableblock > table[frame="void"] {
438 border-style: none;
439}
440div.tableblock > table[frame="hsides"] {
441 border-left-style: none;
442 border-right-style: none;
443}
444div.tableblock > table[frame="vsides"] {
445 border-top-style: none;
446 border-bottom-style: none;
447}
448
449
450/*
451 * html5 specific
452 *
453 * */
454
455table.tableblock {
456 margin-top: 1.0em;
457 margin-bottom: 1.5em;
458}
459thead, p.tableblock.header {
460 font-weight: bold;
461 color: #527bbd;
462}
463p.tableblock {
464 margin-top: 0;
465}
466table.tableblock {
467 border-width: 3px;
468 border-spacing: 0px;
469 border-style: solid;
470 border-color: #527bbd;
471 border-collapse: collapse;
472}
473th.tableblock, td.tableblock {
474 border-width: 1px;
475 padding: 4px;
476 border-style: solid;
477 border-color: #527bbd;
478}
479
480table.tableblock.frame-topbot {
481 border-left-style: hidden;
482 border-right-style: hidden;
483}
484table.tableblock.frame-sides {
485 border-top-style: hidden;
486 border-bottom-style: hidden;
487}
488table.tableblock.frame-none {
489 border-style: hidden;
490}
491
492th.tableblock.halign-left, td.tableblock.halign-left {
493 text-align: left;
494}
495th.tableblock.halign-center, td.tableblock.halign-center {
496 text-align: center;
497}
498th.tableblock.halign-right, td.tableblock.halign-right {
499 text-align: right;
500}
501
502th.tableblock.valign-top, td.tableblock.valign-top {
503 vertical-align: top;
504}
505th.tableblock.valign-middle, td.tableblock.valign-middle {
506 vertical-align: middle;
507}
508th.tableblock.valign-bottom, td.tableblock.valign-bottom {
509 vertical-align: bottom;
510}
511
512
513/*
514 * manpage specific
515 *
516 * */
517
518body.manpage h1 {
Junio C Hamano68cf15a2010-11-06 01:01:59519 padding-top: 0.5em;
520 padding-bottom: 0.5em;
521 border-top: 2px solid silver;
522 border-bottom: 2px solid silver;
523}
Junio C Hamano9d971152012-12-19 00:43:11524body.manpage h2 {
Junio C Hamano68cf15a2010-11-06 01:01:59525 border-style: none;
526}
Junio C Hamano9d971152012-12-19 00:43:11527body.manpage div.sectionbody {
528 margin-left: 3em;
Junio C Hamano68cf15a2010-11-06 01:01:59529}
530
531@media print {
Junio C Hamano9d971152012-12-19 00:43:11532 body.manpage div#toc { display: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59533}
534
Junio C Hamano1a4e8412005-12-27 08:17:23535
Junio C Hamano1a4e8412005-12-27 08:17:23536</style>
Junio C Hamano7bd050f2011-09-22 06:32:22537<script type="text/javascript">
538/*<![CDATA[*/
Junio C Hamano7bd050f2011-09-22 06:32:22539var asciidoc = { // Namespace.
540
541/////////////////////////////////////////////////////////////////////
542// Table Of Contents generator
543/////////////////////////////////////////////////////////////////////
544
545/* Author: Mihai Bazon, September 2002
546 * http://students.infoiasi.ro/~mishoo
547 *
548 * Table Of Content generator
549 * Version: 0.4
550 *
551 * Feel free to use this script under the terms of the GNU General Public
552 * License, as long as you do not remove or alter this notice.
553 */
554
555 /* modified by Troy D. Hanson, September 2006. License: GPL */
556 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
557
558// toclevels = 1..4.
559toc: function (toclevels) {
560
561 function getText(el) {
562 var text = "";
563 for (var i = el.firstChild; i != null; i = i.nextSibling) {
564 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
565 text += i.data;
566 else if (i.firstChild != null)
567 text += getText(i);
568 }
569 return text;
570 }
571
572 function TocEntry(el, text, toclevel) {
573 this.element = el;
574 this.text = text;
575 this.toclevel = toclevel;
576 }
577
578 function tocEntries(el, toclevels) {
579 var result = new Array;
Junio C Hamano9d971152012-12-19 00:43:11580 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
Junio C Hamano7bd050f2011-09-22 06:32:22581 // Function that scans the DOM tree for header elements (the DOM2
582 // nodeIterator API would be a better technique but not supported by all
583 // browsers).
584 var iterate = function (el) {
585 for (var i = el.firstChild; i != null; i = i.nextSibling) {
586 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
587 var mo = re.exec(i.tagName);
588 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
589 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
590 }
591 iterate(i);
592 }
593 }
594 }
595 iterate(el);
596 return result;
597 }
598
599 var toc = document.getElementById("toc");
Junio C Hamano9d971152012-12-19 00:43:11600 if (!toc) {
601 return;
602 }
603
604 // Delete existing TOC entries in case we're reloading the TOC.
605 var tocEntriesToRemove = [];
606 var i;
607 for (i = 0; i < toc.childNodes.length; i++) {
608 var entry = toc.childNodes[i];
609 if (entry.nodeName.toLowerCase() == 'div'
610 && entry.getAttribute("class")
611 && entry.getAttribute("class").match(/^toclevel/))
612 tocEntriesToRemove.push(entry);
613 }
614 for (i = 0; i < tocEntriesToRemove.length; i++) {
615 toc.removeChild(tocEntriesToRemove[i]);
616 }
617
618 // Rebuild TOC entries.
Junio C Hamano7bd050f2011-09-22 06:32:22619 var entries = tocEntries(document.getElementById("content"), toclevels);
620 for (var i = 0; i < entries.length; ++i) {
621 var entry = entries[i];
622 if (entry.element.id == "")
623 entry.element.id = "_toc_" + i;
624 var a = document.createElement("a");
625 a.href = "#" + entry.element.id;
626 a.appendChild(document.createTextNode(entry.text));
627 var div = document.createElement("div");
628 div.appendChild(a);
629 div.className = "toclevel" + entry.toclevel;
630 toc.appendChild(div);
631 }
632 if (entries.length == 0)
633 toc.parentNode.removeChild(toc);
634},
635
636
637/////////////////////////////////////////////////////////////////////
638// Footnotes generator
639/////////////////////////////////////////////////////////////////////
640
641/* Based on footnote generation code from:
642 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
643 */
644
645footnotes: function () {
Junio C Hamano9d971152012-12-19 00:43:11646 // Delete existing footnote entries in case we're reloading the footnodes.
647 var i;
Junio C Hamano7bd050f2011-09-22 06:32:22648 var noteholder = document.getElementById("footnotes");
Junio C Hamano9d971152012-12-19 00:43:11649 if (!noteholder) {
650 return;
651 }
652 var entriesToRemove = [];
653 for (i = 0; i < noteholder.childNodes.length; i++) {
654 var entry = noteholder.childNodes[i];
655 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
656 entriesToRemove.push(entry);
657 }
658 for (i = 0; i < entriesToRemove.length; i++) {
659 noteholder.removeChild(entriesToRemove[i]);
660 }
661
662 // Rebuild footnote entries.
663 var cont = document.getElementById("content");
Junio C Hamano7bd050f2011-09-22 06:32:22664 var spans = cont.getElementsByTagName("span");
665 var refs = {};
666 var n = 0;
667 for (i=0; i<spans.length; i++) {
668 if (spans[i].className == "footnote") {
669 n++;
Junio C Hamano9d971152012-12-19 00:43:11670 var note = spans[i].getAttribute("data-note");
671 if (!note) {
672 // Use [\s\S] in place of . so multi-line matches work.
673 // Because JavaScript has no s (dotall) regex flag.
674 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
675 spans[i].innerHTML =
676 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
677 "' title='View footnote' class='footnote'>" + n + "</a>]";
678 spans[i].setAttribute("data-note", note);
679 }
Junio C Hamano7bd050f2011-09-22 06:32:22680 noteholder.innerHTML +=
681 "<div class='footnote' id='_footnote_" + n + "'>" +
682 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
683 n + "</a>. " + note + "</div>";
Junio C Hamano7bd050f2011-09-22 06:32:22684 var id =spans[i].getAttribute("id");
685 if (id != null) refs["#"+id] = n;
686 }
687 }
688 if (n == 0)
689 noteholder.parentNode.removeChild(noteholder);
690 else {
691 // Process footnoterefs.
692 for (i=0; i<spans.length; i++) {
693 if (spans[i].className == "footnoteref") {
694 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
695 href = href.match(/#.*/)[0]; // Because IE return full URL.
696 n = refs[href];
697 spans[i].innerHTML =
698 "[<a href='#_footnote_" + n +
699 "' title='View footnote' class='footnote'>" + n + "</a>]";
700 }
701 }
702 }
Junio C Hamano9d971152012-12-19 00:43:11703},
704
705install: function(toclevels) {
706 var timerId;
707
708 function reinstall() {
709 asciidoc.footnotes();
710 if (toclevels) {
711 asciidoc.toc(toclevels);
712 }
713 }
714
715 function reinstallAndRemoveTimer() {
716 clearInterval(timerId);
717 reinstall();
718 }
719
720 timerId = setInterval(reinstall, 500);
721 if (document.addEventListener)
722 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
723 else
724 window.onload = reinstallAndRemoveTimer;
Junio C Hamano7bd050f2011-09-22 06:32:22725}
726
727}
Junio C Hamano9d971152012-12-19 00:43:11728asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22729/*]]>*/
730</script>
Junio C Hamano1a4e8412005-12-27 08:17:23731</head>
Junio C Hamano9d971152012-12-19 00:43:11732<body class="manpage">
Junio C Hamano1a4e8412005-12-27 08:17:23733<div id="header">
734<h1>
735git-rebase(1) Manual Page
736</h1>
737<h2>NAME</h2>
738<div class="sectionbody">
739<p>git-rebase -
Junio C Hamano7c73c662007-01-19 00:37:50740 Forward-port local commits to the updated upstream head
Junio C Hamano1a4e8412005-12-27 08:17:23741</p>
742</div>
743</div>
Junio C Hamano7bd050f2011-09-22 06:32:22744<div id="content">
Junio C Hamano9d971152012-12-19 00:43:11745<div class="sect1">
Junio C Hamano68cf15a2010-11-06 01:01:59746<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23747<div class="sectionbody">
Junio C Hamanoa9b8d242007-05-19 04:51:55748<div class="verseblock">
Junio C Hamano9d971152012-12-19 00:43:11749<pre class="content"><em>git rebase</em> [-i | --interactive] [options] [--exec &lt;cmd&gt;] [--onto &lt;newbase&gt;]
Junio C Hamanob02377c2011-04-28 22:26:02750 [&lt;upstream&gt;] [&lt;branch&gt;]
Junio C Hamano02482692012-07-16 05:28:39751<em>git rebase</em> [-i | --interactive] [options] [--exec &lt;cmd&gt;] [--onto &lt;newbase&gt;]
Junio C Hamano15567bc2011-07-23 00:51:59752 --root [&lt;branch&gt;]
Junio C Hamano9d971152012-12-19 00:43:11753<em>git rebase</em> --continue | --skip | --abort | --edit-todo</pre>
754<div class="attribution">
Junio C Hamano68cf15a2010-11-06 01:01:59755</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23756</div>
Junio C Hamano9d971152012-12-19 00:43:11757</div>
758<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31759<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23760<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59761<div class="paragraph"><p>If &lt;branch&gt; is specified, <em>git rebase</em> will perform an automatic
Junio C Hamano9d971152012-12-19 00:43:11762<code>git checkout &lt;branch&gt;</code> before doing anything else. Otherwise
Junio C Hamanoba4b9282008-07-06 05:20:31763it remains on the current branch.</p></div>
Junio C Hamanob02377c2011-04-28 22:26:02764<div class="paragraph"><p>If &lt;upstream&gt; is not specified, the upstream configured in
765branch.&lt;name&gt;.remote and branch.&lt;name&gt;.merge options will be used; see
Junio C Hamanoa28a9202012-06-21 07:08:23766<a href="git-config.html">git-config(1)</a> for details. If you are currently not on any
Junio C Hamanob02377c2011-04-28 22:26:02767branch or if the current branch does not have a configured upstream,
768the rebase will abort.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59769<div class="paragraph"><p>All changes made by commits in the current branch but that are not
Junio C Hamano89d4e0f2007-02-18 00:34:59770in &lt;upstream&gt; are saved to a temporary area. This is the same set
Junio C Hamano9d971152012-12-19 00:43:11771of commits that would be shown by <code>git log &lt;upstream&gt;..HEAD</code> (or
772<code>git log HEAD</code>, if --root is specified).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59773<div class="paragraph"><p>The current branch is reset to &lt;upstream&gt;, or &lt;newbase&gt; if the
Junio C Hamano89d4e0f2007-02-18 00:34:59774--onto option was supplied. This has the exact same effect as
Junio C Hamano9d971152012-12-19 00:43:11775<code>git reset --hard &lt;upstream&gt;</code> (or &lt;newbase&gt;). ORIG_HEAD is set
Junio C Hamano38ddcce2008-07-15 15:49:03776to point at the tip of the branch before the reset.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59777<div class="paragraph"><p>The commits that were previously saved into the temporary area are
Junio C Hamano764a6672007-10-23 01:23:31778then reapplied to the current branch, one by one, in order. Note that
779any commits in HEAD which introduce the same textual changes as a commit
780in HEAD..&lt;upstream&gt; are omitted (i.e., a patch already accepted upstream
Junio C Hamanoba4b9282008-07-06 05:20:31781with a different commit message or timestamp will be skipped).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59782<div class="paragraph"><p>It is possible that a merge failure will prevent this process from being
Junio C Hamano6112cad2006-05-02 07:28:06783completely automatic. You will have to resolve any such merge failure
Junio C Hamano9d971152012-12-19 00:43:11784and run <code>git rebase --continue</code>. Another option is to bypass the commit
785that caused the merge failure with <code>git rebase --skip</code>. To check out the
Junio C Hamano0868a302008-07-22 09:20:44786original &lt;branch&gt; and remove the .git/rebase-apply working files, use the
Junio C Hamano9d971152012-12-19 00:43:11787command <code>git rebase --abort</code> instead.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59788<div class="paragraph"><p>Assume the following history exists and the current branch is "topic":</p></div>
Junio C Hamano6112cad2006-05-02 07:28:06789<div class="listingblock">
Junio C Hamano7e9f6b72006-02-22 10:44:55790<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11791<pre><code> A---B---C topic
Junio C Hamano6112cad2006-05-02 07:28:06792 /
Junio C Hamano9d971152012-12-19 00:43:11793 D---E---F---G master</code></pre>
Junio C Hamano7e9f6b72006-02-22 10:44:55794</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59795<div class="paragraph"><p>From this point, the result of either of the following commands:</p></div>
Junio C Hamano7e9f6b72006-02-22 10:44:55796<div class="literalblock">
797<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11798<pre><code>git rebase master
799git rebase master topic</code></pre>
Junio C Hamano7e9f6b72006-02-22 10:44:55800</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59801<div class="paragraph"><p>would be:</p></div>
Junio C Hamano6112cad2006-05-02 07:28:06802<div class="listingblock">
Junio C Hamano7e9f6b72006-02-22 10:44:55803<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11804<pre><code> A'--B'--C' topic
Junio C Hamano6112cad2006-05-02 07:28:06805 /
Junio C Hamano9d971152012-12-19 00:43:11806 D---E---F---G master</code></pre>
Junio C Hamano7e9f6b72006-02-22 10:44:55807</div></div>
Junio C Hamano9d971152012-12-19 00:43:11808<div class="paragraph"><p><strong>NOTE:</strong> The latter form is just a short-hand of <code>git checkout topic</code>
809followed by <code>git rebase master</code>. When rebase exits <code>topic</code> will
Junio C Hamano92faa802011-03-15 01:00:18810remain the checked-out branch.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59811<div class="paragraph"><p>If the upstream branch already contains a change you have made (e.g.,
Junio C Hamano764a6672007-10-23 01:23:31812because you mailed a patch which was applied upstream), then that commit
Junio C Hamano68cf15a2010-11-06 01:01:59813will be skipped. For example, running &#8216;git rebase master` on the
814following history (in which A&#8217; and A introduce the same set of changes,
Junio C Hamanoba4b9282008-07-06 05:20:31815but have different committer information):</p></div>
Junio C Hamano764a6672007-10-23 01:23:31816<div class="listingblock">
817<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11818<pre><code> A---B---C topic
Junio C Hamano764a6672007-10-23 01:23:31819 /
Junio C Hamano9d971152012-12-19 00:43:11820 D---E---A'---F master</code></pre>
Junio C Hamano764a6672007-10-23 01:23:31821</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59822<div class="paragraph"><p>will result in:</p></div>
Junio C Hamano764a6672007-10-23 01:23:31823<div class="listingblock">
824<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11825<pre><code> B'---C' topic
Junio C Hamano764a6672007-10-23 01:23:31826 /
Junio C Hamano9d971152012-12-19 00:43:11827 D---E---A'---F master</code></pre>
Junio C Hamano764a6672007-10-23 01:23:31828</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59829<div class="paragraph"><p>Here is how you would transplant a topic branch based on one
Junio C Hamanod8c9d432006-11-07 07:19:13830branch to another, to pretend that you forked the topic branch
Junio C Hamano9d971152012-12-19 00:43:11831from the latter branch, using <code>rebase --onto</code>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59832<div class="paragraph"><p>First let&#8217;s assume your <em>topic</em> is based on branch <em>next</em>.
Junio C Hamanoa476efa2008-10-10 15:31:42833For example, a feature developed in <em>topic</em> depends on some
Junio C Hamanoba4b9282008-07-06 05:20:31834functionality which is found in <em>next</em>.</p></div>
Junio C Hamano6112cad2006-05-02 07:28:06835<div class="listingblock">
Junio C Hamano7e9f6b72006-02-22 10:44:55836<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11837<pre><code> o---o---o---o---o master
Junio C Hamanod8c9d432006-11-07 07:19:13838 \
839 o---o---o---o---o next
840 \
Junio C Hamano9d971152012-12-19 00:43:11841 o---o---o topic</code></pre>
Junio C Hamano7e9f6b72006-02-22 10:44:55842</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59843<div class="paragraph"><p>We want to make <em>topic</em> forked from branch <em>master</em>; for example,
Junio C Hamanoa476efa2008-10-10 15:31:42844because the functionality on which <em>topic</em> depends was merged into the
845more stable <em>master</em> branch. We want our tree to look like this:</p></div>
Junio C Hamanod8c9d432006-11-07 07:19:13846<div class="listingblock">
847<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11848<pre><code> o---o---o---o---o master
Junio C Hamanod8c9d432006-11-07 07:19:13849 | \
850 | o'--o'--o' topic
851 \
Junio C Hamano9d971152012-12-19 00:43:11852 o---o---o---o---o next</code></pre>
Junio C Hamanod8c9d432006-11-07 07:19:13853</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59854<div class="paragraph"><p>We can get this using the following command:</p></div>
Junio C Hamanod8c9d432006-11-07 07:19:13855<div class="literalblock">
856<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11857<pre><code>git rebase --onto master next topic</code></pre>
Junio C Hamanod8c9d432006-11-07 07:19:13858</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59859<div class="paragraph"><p>Another example of --onto option is to rebase part of a
Junio C Hamanoba4b9282008-07-06 05:20:31860branch. If we have the following situation:</p></div>
Junio C Hamanod8c9d432006-11-07 07:19:13861<div class="listingblock">
862<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11863<pre><code> H---I---J topicB
Junio C Hamanod8c9d432006-11-07 07:19:13864 /
865 E---F---G topicA
866 /
Junio C Hamano9d971152012-12-19 00:43:11867 A---B---C---D master</code></pre>
Junio C Hamanod8c9d432006-11-07 07:19:13868</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59869<div class="paragraph"><p>then the command</p></div>
Junio C Hamanod8c9d432006-11-07 07:19:13870<div class="literalblock">
871<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11872<pre><code>git rebase --onto master topicA topicB</code></pre>
Junio C Hamanod8c9d432006-11-07 07:19:13873</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59874<div class="paragraph"><p>would result in:</p></div>
Junio C Hamanod8c9d432006-11-07 07:19:13875<div class="listingblock">
876<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11877<pre><code> H'--I'--J' topicB
Junio C Hamanod8c9d432006-11-07 07:19:13878 /
879 | E---F---G topicA
880 |/
Junio C Hamano9d971152012-12-19 00:43:11881 A---B---C---D master</code></pre>
Junio C Hamanod8c9d432006-11-07 07:19:13882</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59883<div class="paragraph"><p>This is useful when topicB does not depend on topicA.</p></div>
884<div class="paragraph"><p>A range of commits could also be removed with rebase. If we have
Junio C Hamanoba4b9282008-07-06 05:20:31885the following situation:</p></div>
Junio C Hamano42f855f2007-02-06 00:09:38886<div class="listingblock">
887<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11888<pre><code> E---F---G---H---I---J topicA</code></pre>
Junio C Hamano42f855f2007-02-06 00:09:38889</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59890<div class="paragraph"><p>then the command</p></div>
Junio C Hamano42f855f2007-02-06 00:09:38891<div class="literalblock">
892<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11893<pre><code>git rebase --onto topicA~5 topicA~3 topicA</code></pre>
Junio C Hamano42f855f2007-02-06 00:09:38894</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59895<div class="paragraph"><p>would result in the removal of commits F and G:</p></div>
Junio C Hamano42f855f2007-02-06 00:09:38896<div class="listingblock">
897<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11898<pre><code> E---H'---I'---J' topicA</code></pre>
Junio C Hamano42f855f2007-02-06 00:09:38899</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59900<div class="paragraph"><p>This is useful if F and G were flawed in some way, or should not be
Junio C Hamano42f855f2007-02-06 00:09:38901part of topicA. Note that the argument to --onto and the &lt;upstream&gt;
Junio C Hamanoba4b9282008-07-06 05:20:31902parameter can be any valid commit-ish.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59903<div class="paragraph"><p>In case of conflict, <em>git rebase</em> will stop at the first problematic commit
Junio C Hamano1aa40d22010-01-21 17:46:43904and leave conflict markers in the tree. You can use <em>git diff</em> to locate
Junio C Hamano6112cad2006-05-02 07:28:06905the markers (&lt;&lt;&lt;&lt;&lt;&lt;) and make edits to resolve the conflict. For each
Junio C Hamano076ffcc2013-02-06 05:13:21906file you edit, you need to tell Git that the conflict has been resolved,
Junio C Hamanoba4b9282008-07-06 05:20:31907typically this would be done with</p></div>
Junio C Hamanof02e09f2006-03-27 07:51:03908<div class="literalblock">
909<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11910<pre><code>git add &lt;filename&gt;</code></pre>
Junio C Hamano6112cad2006-05-02 07:28:06911</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59912<div class="paragraph"><p>After resolving the conflict manually and updating the index with the
Junio C Hamanoba4b9282008-07-06 05:20:31913desired resolution, you can continue the rebasing process with</p></div>
Junio C Hamano6112cad2006-05-02 07:28:06914<div class="literalblock">
915<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11916<pre><code>git rebase --continue</code></pre>
Junio C Hamanof02e09f2006-03-27 07:51:03917</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59918<div class="paragraph"><p>Alternatively, you can undo the <em>git rebase</em> with</p></div>
Junio C Hamanof02e09f2006-03-27 07:51:03919<div class="literalblock">
920<div class="content">
Junio C Hamano9d971152012-12-19 00:43:11921<pre><code>git rebase --abort</code></pre>
Junio C Hamanof02e09f2006-03-27 07:51:03922</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23923</div>
Junio C Hamano9d971152012-12-19 00:43:11924</div>
925<div class="sect1">
Junio C Hamanoea6a7642009-03-11 23:56:19926<h2 id="_configuration">CONFIGURATION</h2>
927<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59928<div class="dlist"><dl>
929<dt class="hdlist1">
Junio C Hamanoea6a7642009-03-11 23:56:19930rebase.stat
931</dt>
932<dd>
933<p>
934 Whether to show a diffstat of what changed upstream since the last
935 rebase. False by default.
936</p>
937</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59938<dt class="hdlist1">
Junio C Hamano075ae872010-09-01 18:43:07939rebase.autosquash
940</dt>
941<dd>
942<p>
943 If set to true enable <em>--autosquash</em> option by default.
944</p>
945</dd>
Junio C Hamanoea6a7642009-03-11 23:56:19946</dl></div>
947</div>
Junio C Hamano9d971152012-12-19 00:43:11948</div>
949<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31950<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23951<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59952<div class="dlist"><dl>
953<dt class="hdlist1">
Junio C Hamano644936c2012-06-28 23:05:14954--onto &lt;newbase&gt;
Junio C Hamano7e9f6b72006-02-22 10:44:55955</dt>
956<dd>
957<p>
958 Starting point at which to create the new commits. If the
959 --onto option is not specified, the starting point is
Junio C Hamano42f855f2007-02-06 00:09:38960 &lt;upstream&gt;. May be any valid commit, and not just an
961 existing branch name.
Junio C Hamano7e9f6b72006-02-22 10:44:55962</p>
Junio C Hamano68cf15a2010-11-06 01:01:59963<div class="paragraph"><p>As a special case, you may use "A...B" as a shortcut for the
Junio C Hamanoe32ec8b2010-06-02 23:32:31964merge base of A and B if there is exactly one merge base. You can
965leave out at most one of A and B, in which case it defaults to HEAD.</p></div>
Junio C Hamano7e9f6b72006-02-22 10:44:55966</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59967<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23968&lt;upstream&gt;
969</dt>
970<dd>
971<p>
Junio C Hamano42f855f2007-02-06 00:09:38972 Upstream branch to compare against. May be any valid commit,
Junio C Hamanob02377c2011-04-28 22:26:02973 not just an existing branch name. Defaults to the configured
974 upstream for the current branch.
Junio C Hamano1a4e8412005-12-27 08:17:23975</p>
976</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59977<dt class="hdlist1">
Junio C Hamano2b135272006-03-18 07:45:42978&lt;branch&gt;
Junio C Hamano1a4e8412005-12-27 08:17:23979</dt>
980<dd>
981<p>
982 Working branch; defaults to HEAD.
983</p>
984</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59985<dt class="hdlist1">
Junio C Hamano6112cad2006-05-02 07:28:06986--continue
987</dt>
988<dd>
989<p>
990 Restart the rebasing process after having resolved a merge conflict.
991</p>
992</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59993<dt class="hdlist1">
Junio C Hamano6112cad2006-05-02 07:28:06994--abort
995</dt>
996<dd>
997<p>
Junio C Hamano15567bc2011-07-23 00:51:59998 Abort the rebase operation and reset HEAD to the original
999 branch. If &lt;branch&gt; was provided when the rebase operation was
1000 started, then HEAD will be reset to &lt;branch&gt;. Otherwise HEAD
1001 will be reset to where it was when the rebase operation was
1002 started.
Junio C Hamano6112cad2006-05-02 07:28:061003</p>
1004</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591005<dt class="hdlist1">
Junio C Hamano37e389e2012-04-30 22:36:091006--keep-empty
1007</dt>
1008<dd>
1009<p>
1010 Keep the commits that do not change anything from its
1011 parents in the result.
1012</p>
1013</dd>
1014<dt class="hdlist1">
Junio C Hamano97f518c2006-06-22 19:49:351015--skip
1016</dt>
1017<dd>
1018<p>
1019 Restart the rebasing process by skipping the current patch.
Junio C Hamano97f518c2006-06-22 19:49:351020</p>
1021</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591022<dt class="hdlist1">
Junio C Hamano9cdfecf2012-09-30 07:38:361023--edit-todo
1024</dt>
1025<dd>
1026<p>
1027 Edit the todo list during an interactive rebase.
1028</p>
1029</dd>
1030<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471031-m
1032</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591033<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471034--merge
Junio C Hamano97f518c2006-06-22 19:49:351035</dt>
1036<dd>
1037<p>
1038 Use merging strategies to rebase. When the recursive (default) merge
1039 strategy is used, this allows rebase to be aware of renames on the
1040 upstream side.
1041</p>
Junio C Hamano68cf15a2010-11-06 01:01:591042<div class="paragraph"><p>Note that a rebase merge works by replaying each commit from the working
Junio C Hamanobf984de2009-11-23 06:11:191043branch on top of the &lt;upstream&gt; branch. Because of this, when a merge
1044conflict happens, the side reported as <em>ours</em> is the so-far rebased
1045series, starting with &lt;upstream&gt;, and <em>theirs</em> is the working branch. In
1046other words, the sides are swapped.</p></div>
Junio C Hamano97f518c2006-06-22 19:49:351047</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591048<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471049-s &lt;strategy&gt;
1050</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591051<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471052--strategy=&lt;strategy&gt;
Junio C Hamano97f518c2006-06-22 19:49:351053</dt>
1054<dd>
1055<p>
Junio C Hamano52d5def2009-05-21 16:27:431056 Use the given merge strategy.
Junio C Hamano9d971152012-12-19 00:43:111057 If there is no <code>-s</code> option <em>git merge-recursive</em> is used
Junio C Hamanobf984de2009-11-23 06:11:191058 instead. This implies --merge.
Junio C Hamano97f518c2006-06-22 19:49:351059</p>
Junio C Hamano68cf15a2010-11-06 01:01:591060<div class="paragraph"><p>Because <em>git rebase</em> replays each commit from the working branch
Junio C Hamanobf984de2009-11-23 06:11:191061on top of the &lt;upstream&gt; branch using the given strategy, using
1062the <em>ours</em> strategy simply discards all patches from the &lt;branch&gt;,
1063which makes little sense.</p></div>
Junio C Hamano97f518c2006-06-22 19:49:351064</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591065<dt class="hdlist1">
Junio C Hamano619596a2010-08-18 22:15:351066-X &lt;strategy-option&gt;
1067</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591068<dt class="hdlist1">
Junio C Hamano619596a2010-08-18 22:15:351069--strategy-option=&lt;strategy-option&gt;
1070</dt>
1071<dd>
1072<p>
1073 Pass the &lt;strategy-option&gt; through to the merge strategy.
Junio C Hamano9d971152012-12-19 00:43:111074 This implies <code>--merge</code> and, if no strategy has been
1075 specified, <code>-s recursive</code>. Note the reversal of <em>ours</em> and
1076 <em>theirs</em> as noted above for the <code>-m</code> option.
Junio C Hamano619596a2010-08-18 22:15:351077</p>
1078</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591079<dt class="hdlist1">
Junio C Hamano2c14c8d2009-07-02 03:17:001080-q
1081</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591082<dt class="hdlist1">
Junio C Hamano2c14c8d2009-07-02 03:17:001083--quiet
1084</dt>
1085<dd>
1086<p>
1087 Be quiet. Implies --no-stat.
1088</p>
1089</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591090<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471091-v
1092</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591093<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471094--verbose
Junio C Hamanofbe00522006-10-19 05:58:481095</dt>
1096<dd>
1097<p>
Junio C Hamanoea6a7642009-03-11 23:56:191098 Be verbose. Implies --stat.
1099</p>
1100</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591101<dt class="hdlist1">
Junio C Hamanoea6a7642009-03-11 23:56:191102--stat
1103</dt>
1104<dd>
1105<p>
1106 Show a diffstat of what changed upstream since the last rebase. The
1107 diffstat is also controlled by the configuration option rebase.stat.
1108</p>
1109</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591110<dt class="hdlist1">
Junio C Hamanoea6a7642009-03-11 23:56:191111-n
1112</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591113<dt class="hdlist1">
Junio C Hamanoea6a7642009-03-11 23:56:191114--no-stat
1115</dt>
1116<dd>
1117<p>
1118 Do not show a diffstat as part of the rebase process.
Junio C Hamanofbe00522006-10-19 05:58:481119</p>
1120</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591121<dt class="hdlist1">
Junio C Hamano7d06a8a2008-10-20 05:42:331122--no-verify
1123</dt>
1124<dd>
1125<p>
Junio C Hamanoa28a9202012-06-21 07:08:231126 This option bypasses the pre-rebase hook. See also <a href="githooks.html">githooks(5)</a>.
Junio C Hamano7d06a8a2008-10-20 05:42:331127</p>
1128</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591129<dt class="hdlist1">
Junio C Hamanoeef01fe2010-12-13 08:31:581130--verify
1131</dt>
1132<dd>
1133<p>
1134 Allows the pre-rebase hook to run, which is the default. This option can
Junio C Hamanoa28a9202012-06-21 07:08:231135 be used to override --no-verify. See also <a href="githooks.html">githooks(5)</a>.
Junio C Hamanoeef01fe2010-12-13 08:31:581136</p>
1137</dd>
1138<dt class="hdlist1">
Junio C Hamanod3339982007-02-09 08:38:481139-C&lt;n&gt;
1140</dt>
1141<dd>
1142<p>
1143 Ensure at least &lt;n&gt; lines of surrounding context match before
1144 and after each change. When fewer lines of surrounding
1145 context exist they all must match. By default no context is
1146 ever ignored.
1147</p>
1148</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591149<dt class="hdlist1">
Junio C Hamanoa973f1c2009-03-19 17:47:521150-f
1151</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591152<dt class="hdlist1">
Junio C Hamanoa973f1c2009-03-19 17:47:521153--force-rebase
1154</dt>
1155<dd>
1156<p>
1157 Force the rebase even if the current branch is a descendant
Junio C Hamanoef8fbf92010-04-04 19:12:021158 of the commit you are rebasing onto. Normally non-interactive rebase will
Junio C Hamanoa973f1c2009-03-19 17:47:521159 exit with the message "Current branch is up to date" in such a
1160 situation.
Junio C Hamanoef8fbf92010-04-04 19:12:021161 Incompatible with the --interactive option.
Junio C Hamanoa973f1c2009-03-19 17:47:521162</p>
Junio C Hamano68cf15a2010-11-06 01:01:591163<div class="paragraph"><p>You may find this (or --no-ff with an interactive rebase) helpful after
Junio C Hamanoef8fbf92010-04-04 19:12:021164reverting a topic branch merge, as this option recreates the topic branch with
1165fresh commits so it can be remerged successfully without needing to "revert
1166the reversion" (see the
1167<a href="howto/revert-a-faulty-merge.txt">revert-a-faulty-merge How-To</a> for details).</p></div>
Junio C Hamanoa973f1c2009-03-19 17:47:521168</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591169<dt class="hdlist1">
Junio C Hamanofe24db02009-08-22 05:10:471170--ignore-whitespace
1171</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591172<dt class="hdlist1">
Junio C Hamanof8a79222009-03-01 08:02:501173--whitespace=&lt;option&gt;
Junio C Hamano250f03e2007-09-10 01:33:281174</dt>
1175<dd>
1176<p>
Junio C Hamano1aa40d22010-01-21 17:46:431177 These flag are passed to the <em>git apply</em> program
Junio C Hamanoa28a9202012-06-21 07:08:231178 (see <a href="git-apply.html">git-apply(1)</a>) that applies the patch.
Junio C Hamanoec3b9a72009-02-13 08:45:521179 Incompatible with the --interactive option.
Junio C Hamano250f03e2007-09-10 01:33:281180</p>
1181</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591182<dt class="hdlist1">
Junio C Hamanoa973f1c2009-03-19 17:47:521183--committer-date-is-author-date
1184</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591185<dt class="hdlist1">
Junio C Hamanoa973f1c2009-03-19 17:47:521186--ignore-date
1187</dt>
1188<dd>
1189<p>
Junio C Hamano1aa40d22010-01-21 17:46:431190 These flags are passed to <em>git am</em> to easily change the dates
Junio C Hamanoa28a9202012-06-21 07:08:231191 of the rebased commits (see <a href="git-am.html">git-am(1)</a>).
Junio C Hamanoe97d5772010-05-19 08:13:581192 Incompatible with the --interactive option.
Junio C Hamanoa973f1c2009-03-19 17:47:521193</p>
1194</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591195<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471196-i
1197</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591198<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471199--interactive
Junio C Hamano1d90cb02007-07-03 07:05:311200</dt>
1201<dd>
1202<p>
1203 Make a list of the commits which are about to be rebased. Let the
Junio C Hamanodbb64592007-09-01 11:17:391204 user edit that list before rebasing. This mode can also be used to
1205 split commits (see SPLITTING COMMITS below).
Junio C Hamano1d90cb02007-07-03 07:05:311206</p>
1207</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591208<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471209-p
1210</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591211<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471212--preserve-merges
Junio C Hamano1d90cb02007-07-03 07:05:311213</dt>
1214<dd>
1215<p>
Junio C Hamano7d06a8a2008-10-20 05:42:331216 Instead of ignoring merges, try to recreate them.
Junio C Hamano1d90cb02007-07-03 07:05:311217</p>
Junio C Hamano9d971152012-12-19 00:43:111218<div class="paragraph"><p>This uses the <code>--interactive</code> machinery internally, but combining it
1219with the <code>--interactive</code> option explicitly is generally not a good
Junio C Hamanobb88cf42010-06-21 15:23:551220idea unless you know what you are doing (see BUGS below).</p></div>
Junio C Hamano1d90cb02007-07-03 07:05:311221</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591222<dt class="hdlist1">
Junio C Hamano644936c2012-06-28 23:05:141223-x &lt;cmd&gt;
1224</dt>
1225<dt class="hdlist1">
1226--exec &lt;cmd&gt;
1227</dt>
1228<dd>
1229<p>
1230 Append "exec &lt;cmd&gt;" after each line creating a commit in the
1231 final history. &lt;cmd&gt; will be interpreted as one or more shell
1232 commands.
1233</p>
Junio C Hamano9d971152012-12-19 00:43:111234<div class="paragraph"><p>This option can only be used with the <code>--interactive</code> option
Junio C Hamano644936c2012-06-28 23:05:141235(see INTERACTIVE MODE below).</p></div>
Junio C Hamano9d971152012-12-19 00:43:111236<div class="paragraph"><p>You may execute several commands by either using one instance of <code>--exec</code>
Junio C Hamano644936c2012-06-28 23:05:141237with several commands:</p></div>
1238<div class="literalblock">
1239<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111240<pre><code>git rebase -i --exec "cmd1 &amp;&amp; cmd2 &amp;&amp; ..."</code></pre>
Junio C Hamano644936c2012-06-28 23:05:141241</div></div>
Junio C Hamano9d971152012-12-19 00:43:111242<div class="paragraph"><p>or by giving more than one <code>--exec</code>:</p></div>
Junio C Hamano644936c2012-06-28 23:05:141243<div class="literalblock">
1244<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111245<pre><code>git rebase -i --exec "cmd1" --exec "cmd2" --exec ...</code></pre>
Junio C Hamano644936c2012-06-28 23:05:141246</div></div>
Junio C Hamano9d971152012-12-19 00:43:111247<div class="paragraph"><p>If <code>--autosquash</code> is used, "exec" lines will not be appended for
Junio C Hamano644936c2012-06-28 23:05:141248the intermediate commits, and will only appear at the end of each
1249squash/fixup series.</p></div>
1250</dd>
1251<dt class="hdlist1">
Junio C Hamanobd53dbf2009-01-18 18:26:371252--root
1253</dt>
1254<dd>
1255<p>
1256 Rebase all commits reachable from &lt;branch&gt;, instead of
1257 limiting them with an &lt;upstream&gt;. This allows you to rebase
Junio C Hamano02482692012-07-16 05:28:391258 the root commit(s) on a branch. When used with --onto, it
Junio C Hamanobd53dbf2009-01-18 18:26:371259 will skip changes already contained in &lt;newbase&gt; (instead of
Junio C Hamano02482692012-07-16 05:28:391260 &lt;upstream&gt;) whereas without --onto it will operate on every change.
1261 When used together with both --onto and --preserve-merges,
1262 <em>all</em> root commits will be rewritten to have &lt;newbase&gt; as parent
Junio C Hamanobd53dbf2009-01-18 18:26:371263 instead.
1264</p>
1265</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591266<dt class="hdlist1">
Junio C Hamanoa9701f02010-01-21 00:42:161267--autosquash
1268</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591269<dt class="hdlist1">
Junio C Hamano075ae872010-09-01 18:43:071270--no-autosquash
1271</dt>
Junio C Hamanoa9701f02010-01-21 00:42:161272<dd>
1273<p>
1274 When the commit log message begins with "squash! &#8230;" (or
1275 "fixup! &#8230;"), and there is a commit whose title begins with
1276 the same &#8230;, automatically modify the todo list of rebase -i
Junio C Hamano364b6a42010-01-22 07:57:591277 so that the commit marked for squashing comes right after the
Junio C Hamanoa9701f02010-01-21 00:42:161278 commit to be modified, and change the action of the moved
Junio C Hamano9d971152012-12-19 00:43:111279 commit from <code>pick</code> to <code>squash</code> (or <code>fixup</code>).
Junio C Hamanoa9701f02010-01-21 00:42:161280</p>
Junio C Hamano68cf15a2010-11-06 01:01:591281<div class="paragraph"><p>This option is only valid when the <em>--interactive</em> option is used.</p></div>
1282<div class="paragraph"><p>If the <em>--autosquash</em> option is enabled by default using the
Junio C Hamano9d971152012-12-19 00:43:111283configuration variable <code>rebase.autosquash</code>, this option can be
Junio C Hamano075ae872010-09-01 18:43:071284used to override and disable this setting.</p></div>
Junio C Hamanoef8fbf92010-04-04 19:12:021285</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591286<dt class="hdlist1">
Junio C Hamanoef8fbf92010-04-04 19:12:021287--no-ff
1288</dt>
1289<dd>
1290<p>
1291 With --interactive, cherry-pick all rebased commits instead of
1292 fast-forwarding over the unchanged ones. This ensures that the
1293 entire history of the rebased branch is composed of new commits.
1294</p>
Junio C Hamano68cf15a2010-11-06 01:01:591295<div class="paragraph"><p>Without --interactive, this is a synonym for --force-rebase.</p></div>
1296<div class="paragraph"><p>You may find this helpful after reverting a topic branch merge, as this option
Junio C Hamanoef8fbf92010-04-04 19:12:021297recreates the topic branch with fresh commits so it can be remerged
1298successfully without needing to "revert the reversion" (see the
1299<a href="howto/revert-a-faulty-merge.txt">revert-a-faulty-merge How-To</a> for details).</p></div>
Junio C Hamanoa9701f02010-01-21 00:42:161300</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311301</dl></div>
Junio C Hamano97f518c2006-06-22 19:49:351302</div>
Junio C Hamano9d971152012-12-19 00:43:111303</div>
1304<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311305<h2 id="_merge_strategies">MERGE STRATEGIES</h2>
Junio C Hamano97f518c2006-06-22 19:49:351306<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591307<div class="paragraph"><p>The merge mechanism (<em>git-merge</em> and <em>git-pull</em> commands) allows the
Junio C Hamano9d971152012-12-19 00:43:111308backend <em>merge strategies</em> to be chosen with <code>-s</code> option. Some strategies
1309can also take their own options, which can be passed by giving <code>-X&lt;option&gt;</code>
Junio C Hamano1aa40d22010-01-21 17:46:431310arguments to <em>git-merge</em> and/or <em>git-pull</em>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591311<div class="dlist"><dl>
1312<dt class="hdlist1">
Junio C Hamano97f518c2006-06-22 19:49:351313resolve
1314</dt>
1315<dd>
1316<p>
1317 This can only resolve two heads (i.e. the current branch
Junio C Hamano1de75722009-03-26 08:39:381318 and another branch you pulled from) using a 3-way merge
Junio C Hamano97f518c2006-06-22 19:49:351319 algorithm. It tries to carefully detect criss-cross
1320 merge ambiguities and is considered generally safe and
1321 fast.
1322</p>
1323</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591324<dt class="hdlist1">
Junio C Hamano97f518c2006-06-22 19:49:351325recursive
1326</dt>
1327<dd>
1328<p>
Junio C Hamano1de75722009-03-26 08:39:381329 This can only resolve two heads using a 3-way merge
1330 algorithm. When there is more than one common
1331 ancestor that can be used for 3-way merge, it creates a
Junio C Hamano97f518c2006-06-22 19:49:351332 merged tree of the common ancestors and uses that as
1333 the reference tree for the 3-way merge. This has been
1334 reported to result in fewer merge conflicts without
1335 causing mis-merges by tests done on actual merge commits
1336 taken from Linux 2.6 kernel development history.
1337 Additionally this can detect and handle merges involving
1338 renames. This is the default merge strategy when
1339 pulling or merging one branch.
1340</p>
Junio C Hamano68cf15a2010-11-06 01:01:591341<div class="paragraph"><p>The <em>recursive</em> strategy can take the following options:</p></div>
1342<div class="dlist"><dl>
1343<dt class="hdlist1">
Junio C Hamano1aa40d22010-01-21 17:46:431344ours
1345</dt>
1346<dd>
1347<p>
1348 This option forces conflicting hunks to be auto-resolved cleanly by
1349 favoring <em>our</em> version. Changes from the other tree that do not
1350 conflict with our side are reflected to the merge result.
Junio C Hamanoa3cfb762012-09-15 05:32:141351 For a binary file, the entire contents are taken from our side.
Junio C Hamano1aa40d22010-01-21 17:46:431352</p>
Junio C Hamano68cf15a2010-11-06 01:01:591353<div class="paragraph"><p>This should not be confused with the <em>ours</em> merge strategy, which does not
Junio C Hamano1aa40d22010-01-21 17:46:431354even look at what the other tree contains at all. It discards everything
1355the other tree did, declaring <em>our</em> history contains all that happened in it.</p></div>
1356</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591357<dt class="hdlist1">
Junio C Hamano1aa40d22010-01-21 17:46:431358theirs
1359</dt>
1360<dd>
1361<p>
Junio C Hamanoa3cfb762012-09-15 05:32:141362 This is the opposite of <em>ours</em>.
Junio C Hamano1aa40d22010-01-21 17:46:431363</p>
1364</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591365<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541366patience
1367</dt>
1368<dd>
1369<p>
1370 With this option, <em>merge-recursive</em> spends a little extra time
1371 to avoid mismerges that sometimes occur due to unimportant
1372 matching lines (e.g., braces from distinct functions). Use
1373 this when the branches to be merged have diverged wildly.
Junio C Hamano9d971152012-12-19 00:43:111374 See also <a href="git-diff.html">git-diff(1)</a> <code>--patience</code>.
Junio C Hamano39c7a692010-10-27 06:08:541375</p>
1376</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591377<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541378ignore-space-change
1379</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591380<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541381ignore-all-space
1382</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591383<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541384ignore-space-at-eol
1385</dt>
1386<dd>
1387<p>
1388 Treats lines with the indicated type of whitespace change as
1389 unchanged for the sake of a three-way merge. Whitespace
1390 changes mixed with other changes to a line are not ignored.
Junio C Hamano9d971152012-12-19 00:43:111391 See also <a href="git-diff.html">git-diff(1)</a> <code>-b</code>, <code>-w</code>, and
1392 <code>--ignore-space-at-eol</code>.
Junio C Hamano39c7a692010-10-27 06:08:541393</p>
Junio C Hamano68cf15a2010-11-06 01:01:591394<div class="ulist"><ul>
Junio C Hamano39c7a692010-10-27 06:08:541395<li>
1396<p>
1397If <em>their</em> version only introduces whitespace changes to a line,
1398 <em>our</em> version is used;
1399</p>
1400</li>
1401<li>
1402<p>
1403If <em>our</em> version introduces whitespace changes but <em>their</em>
1404 version includes a substantial change, <em>their</em> version is used;
1405</p>
1406</li>
1407<li>
1408<p>
1409Otherwise, the merge proceeds in the usual way.
1410</p>
1411</li>
1412</ul></div>
1413</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591414<dt class="hdlist1">
Junio C Hamano2db3e752010-09-03 21:33:061415renormalize
1416</dt>
1417<dd>
1418<p>
1419 This runs a virtual check-out and check-in of all three stages
1420 of a file when resolving a three-way merge. This option is
1421 meant to be used when merging branches with different clean
1422 filters or end-of-line normalization rules. See "Merging
1423 branches with differing checkin/checkout attributes" in
Junio C Hamanoa28a9202012-06-21 07:08:231424 <a href="gitattributes.html">gitattributes(5)</a> for details.
Junio C Hamano2db3e752010-09-03 21:33:061425</p>
1426</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591427<dt class="hdlist1">
Junio C Hamano2db3e752010-09-03 21:33:061428no-renormalize
1429</dt>
1430<dd>
1431<p>
Junio C Hamano9d971152012-12-19 00:43:111432 Disables the <code>renormalize</code> option. This overrides the
1433 <code>merge.renormalize</code> configuration variable.
Junio C Hamano2db3e752010-09-03 21:33:061434</p>
1435</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591436<dt class="hdlist1">
Junio C Hamano39c7a692010-10-27 06:08:541437rename-threshold=&lt;n&gt;
1438</dt>
1439<dd>
1440<p>
1441 Controls the similarity threshold used for rename detection.
Junio C Hamano9d971152012-12-19 00:43:111442 See also <a href="git-diff.html">git-diff(1)</a> <code>-M</code>.
Junio C Hamano39c7a692010-10-27 06:08:541443</p>
1444</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591445<dt class="hdlist1">
Junio C Hamanod2179ef2010-10-22 04:12:171446subtree[=&lt;path&gt;]
Junio C Hamano1aa40d22010-01-21 17:46:431447</dt>
1448<dd>
1449<p>
1450 This option is a more advanced form of <em>subtree</em> strategy, where
1451 the strategy makes a guess on how two trees must be shifted to
1452 match with each other when merging. Instead, the specified path
1453 is prefixed (or stripped from the beginning) to make the shape of
1454 two trees to match.
1455</p>
1456</dd>
1457</dl></div>
Junio C Hamano97f518c2006-06-22 19:49:351458</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591459<dt class="hdlist1">
Junio C Hamano97f518c2006-06-22 19:49:351460octopus
1461</dt>
1462<dd>
1463<p>
Junio C Hamano1de75722009-03-26 08:39:381464 This resolves cases with more than two heads, but refuses to do
1465 a complex merge that needs manual resolution. It is
Junio C Hamano97f518c2006-06-22 19:49:351466 primarily meant to be used for bundling topic branch
1467 heads together. This is the default merge strategy when
Junio C Hamano1de75722009-03-26 08:39:381468 pulling or merging more than one branch.
Junio C Hamano97f518c2006-06-22 19:49:351469</p>
1470</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591471<dt class="hdlist1">
Junio C Hamano97f518c2006-06-22 19:49:351472ours
1473</dt>
1474<dd>
1475<p>
Junio C Hamanobf984de2009-11-23 06:11:191476 This resolves any number of heads, but the resulting tree of the
1477 merge is always that of the current branch head, effectively
1478 ignoring all changes from all other branches. It is meant to
Junio C Hamano97f518c2006-06-22 19:49:351479 be used to supersede old development history of side
Junio C Hamano1aa40d22010-01-21 17:46:431480 branches. Note that this is different from the -Xours option to
1481 the <em>recursive</em> merge strategy.
Junio C Hamano97f518c2006-06-22 19:49:351482</p>
1483</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591484<dt class="hdlist1">
Junio C Hamanoe6c92032008-03-19 09:24:341485subtree
1486</dt>
1487<dd>
1488<p>
1489 This is a modified recursive strategy. When merging trees A and
1490 B, if B corresponds to a subtree of A, B is first adjusted to
1491 match the tree structure of A, instead of reading the trees at
1492 the same level. This adjustment is also done to the common
1493 ancestor tree.
1494</p>
1495</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311496</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231497</div>
Junio C Hamano9d971152012-12-19 00:43:111498</div>
1499<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311500<h2 id="_notes">NOTES</h2>
Junio C Hamano6112cad2006-05-02 07:28:061501<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591502<div class="paragraph"><p>You should understand the implications of using <em>git rebase</em> on a
Junio C Hamano7d06a8a2008-10-20 05:42:331503repository that you share. See also RECOVERING FROM UPSTREAM REBASE
1504below.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591505<div class="paragraph"><p>When the git-rebase command is run, it will first execute a "pre-rebase"
Junio C Hamano6112cad2006-05-02 07:28:061506hook if one exists. You can use this hook to do sanity checks and
Junio C Hamano68cf15a2010-11-06 01:01:591507reject the rebase if it isn&#8217;t appropriate. Please see the template
Junio C Hamanoba4b9282008-07-06 05:20:311508pre-rebase hook script for an example.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591509<div class="paragraph"><p>Upon completion, &lt;branch&gt; will be the current branch.</p></div>
Junio C Hamano6112cad2006-05-02 07:28:061510</div>
Junio C Hamano9d971152012-12-19 00:43:111511</div>
1512<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311513<h2 id="_interactive_mode">INTERACTIVE MODE</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231514<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591515<div class="paragraph"><p>Rebasing interactively means that you have a chance to edit the commits
Junio C Hamano1d90cb02007-07-03 07:05:311516which are rebased. You can reorder the commits, and you can
Junio C Hamanoba4b9282008-07-06 05:20:311517remove them (weeding out bad or otherwise unwanted patches).</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591518<div class="paragraph"><p>The interactive mode is meant for this type of workflow:</p></div>
1519<div class="olist arabic"><ol class="arabic">
Junio C Hamano1d90cb02007-07-03 07:05:311520<li>
1521<p>
1522have a wonderful idea
1523</p>
1524</li>
1525<li>
1526<p>
1527hack on the code
1528</p>
1529</li>
1530<li>
1531<p>
1532prepare a series for submission
1533</p>
1534</li>
1535<li>
1536<p>
1537submit
1538</p>
1539</li>
Junio C Hamanoba4b9282008-07-06 05:20:311540</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591541<div class="paragraph"><p>where point 2. consists of several instances of</p></div>
Junio C Hamano0ff98162012-03-31 18:19:091542<div class="paragraph"><p>a) regular use</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591543<div class="olist arabic"><ol class="arabic">
Junio C Hamano1d90cb02007-07-03 07:05:311544<li>
1545<p>
1546finish something worthy of a commit
1547</p>
1548</li>
1549<li>
1550<p>
1551commit
1552</p>
1553</li>
Junio C Hamanoba4b9282008-07-06 05:20:311554</ol></div>
Junio C Hamano0ff98162012-03-31 18:19:091555<div class="paragraph"><p>b) independent fixup</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591556<div class="olist arabic"><ol class="arabic">
Junio C Hamano1d90cb02007-07-03 07:05:311557<li>
1558<p>
1559realize that something does not work
1560</p>
1561</li>
1562<li>
1563<p>
1564fix that
1565</p>
1566</li>
1567<li>
1568<p>
1569commit it
1570</p>
1571</li>
Junio C Hamanoba4b9282008-07-06 05:20:311572</ol></div>
Junio C Hamano68cf15a2010-11-06 01:01:591573<div class="paragraph"><p>Sometimes the thing fixed in b.2. cannot be amended to the not-quite
Junio C Hamano1d90cb02007-07-03 07:05:311574perfect commit it fixes, because that commit is buried deeply in a
1575patch series. That is exactly what interactive rebase is for: use it
1576after plenty of "a"s and "b"s, by rearranging and editing
Junio C Hamanoba4b9282008-07-06 05:20:311577commits, and squashing multiple commits into one.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591578<div class="paragraph"><p>Start it with the last commit you want to retain as-is:</p></div>
Junio C Hamano1d90cb02007-07-03 07:05:311579<div class="literalblock">
1580<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111581<pre><code>git rebase -i &lt;after-this-commit&gt;</code></pre>
Junio C Hamano1d90cb02007-07-03 07:05:311582</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591583<div class="paragraph"><p>An editor will be fired up with all the commits in your current branch
Junio C Hamano1d90cb02007-07-03 07:05:311584(ignoring merge commits), which come after the given commit. You can
Junio C Hamano68cf15a2010-11-06 01:01:591585reorder the commits in this list to your heart&#8217;s content, and you can
Junio C Hamanoba4b9282008-07-06 05:20:311586remove them. The list looks more or less like this:</p></div>
Junio C Hamano1d90cb02007-07-03 07:05:311587<div class="listingblock">
1588<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111589<pre><code>pick deadbee The oneline of this commit
Junio C Hamano1d90cb02007-07-03 07:05:311590pick fa1afe1 The oneline of the next commit
Junio C Hamano9d971152012-12-19 00:43:111591...</code></pre>
Junio C Hamano1d90cb02007-07-03 07:05:311592</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591593<div class="paragraph"><p>The oneline descriptions are purely for your pleasure; <em>git rebase</em> will
Junio C Hamano1d90cb02007-07-03 07:05:311594not look at them but at the commit names ("deadbee" and "fa1afe1" in this
Junio C Hamanoba4b9282008-07-06 05:20:311595example), so do not delete or edit the names.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591596<div class="paragraph"><p>By replacing the command "pick" with the command "edit", you can tell
Junio C Hamano1aa40d22010-01-21 17:46:431597<em>git rebase</em> to stop after applying that commit, so that you can edit
Junio C Hamano1d90cb02007-07-03 07:05:311598the files and/or the commit message, amend the commit, and continue
Junio C Hamanoba4b9282008-07-06 05:20:311599rebasing.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591600<div class="paragraph"><p>If you just want to edit the commit message for a commit, replace the
Junio C Hamano3d23a0a2009-10-19 08:04:301601command "pick" with the command "reword".</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591602<div class="paragraph"><p>If you want to fold two or more commits into one, replace the command
Junio C Hamanoa9701f02010-01-21 00:42:161603"pick" for the second and subsequent commits with "squash" or "fixup".
1604If the commits had different authors, the folded commit will be
1605attributed to the author of the first commit. The suggested commit
1606message for the folded commit is the concatenation of the commit
1607messages of the first commit and of those with the "squash" command,
1608but omits the commit messages of commits with the "fixup" command.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591609<div class="paragraph"><p><em>git rebase</em> will stop when "pick" has been replaced with "edit" or
Junio C Hamano3d23a0a2009-10-19 08:04:301610when a command fails due to merge errors. When you are done editing
Junio C Hamano9d971152012-12-19 00:43:111611and/or resolving conflicts you can continue with <code>git rebase --continue</code>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591612<div class="paragraph"><p>For example, if you want to reorder the last 5 commits, such that what
Junio C Hamano1d90cb02007-07-03 07:05:311613was HEAD~4 becomes the new HEAD. To achieve that, you would call
Junio C Hamano1aa40d22010-01-21 17:46:431614<em>git rebase</em> like this:</p></div>
Junio C Hamano1d90cb02007-07-03 07:05:311615<div class="listingblock">
1616<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111617<pre><code>$ git rebase -i HEAD~5</code></pre>
Junio C Hamano1d90cb02007-07-03 07:05:311618</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591619<div class="paragraph"><p>And move the first patch to the end of the list.</p></div>
1620<div class="paragraph"><p>You might want to preserve merges, if you have a history like this:</p></div>
Junio C Hamano1d90cb02007-07-03 07:05:311621<div class="listingblock">
1622<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111623<pre><code> X
Junio C Hamano1d90cb02007-07-03 07:05:311624 \
1625 A---M---B
1626 /
Junio C Hamano9d971152012-12-19 00:43:111627---o---O---P---Q</code></pre>
Junio C Hamano1d90cb02007-07-03 07:05:311628</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591629<div class="paragraph"><p>Suppose you want to rebase the side branch starting at "A" to "Q". Make
Junio C Hamanoba4b9282008-07-06 05:20:311630sure that the current HEAD is "B", and call</p></div>
Junio C Hamano1d90cb02007-07-03 07:05:311631<div class="listingblock">
1632<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111633<pre><code>$ git rebase -i -p --onto Q O</code></pre>
Junio C Hamano1d90cb02007-07-03 07:05:311634</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591635<div class="paragraph"><p>Reordering and editing commits usually creates untested intermediate
Junio C Hamano53ba6d02010-08-22 07:25:121636steps. You may want to check that your history editing did not break
1637anything by running a test, or at least recompiling at intermediate
1638points in history by using the "exec" command (shortcut "x"). You may
1639do so by creating a todo list like this one:</p></div>
1640<div class="listingblock">
1641<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111642<pre><code>pick deadbee Implement feature XXX
Junio C Hamano53ba6d02010-08-22 07:25:121643fixup f1a5c00 Fix to feature XXX
1644exec make
1645pick c0ffeee The oneline of the next commit
1646edit deadbab The oneline of the commit after
1647exec cd subdir; make test
Junio C Hamano9d971152012-12-19 00:43:111648...</code></pre>
Junio C Hamano53ba6d02010-08-22 07:25:121649</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591650<div class="paragraph"><p>The interactive rebase will stop when a command fails (i.e. exits with
Junio C Hamano53ba6d02010-08-22 07:25:121651non-0 status) to give you an opportunity to fix the problem. You can
Junio C Hamano9d971152012-12-19 00:43:111652continue with <code>git rebase --continue</code>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591653<div class="paragraph"><p>The "exec" command launches the command in a shell (the one specified
Junio C Hamano9d971152012-12-19 00:43:111654in <code>$SHELL</code>, or the default shell if <code>$SHELL</code> is not set), so you can
Junio C Hamano53ba6d02010-08-22 07:25:121655use shell features (like "cd", "&gt;", ";" &#8230;). The command is run from
1656the root of the working tree.</p></div>
Junio C Hamano644936c2012-06-28 23:05:141657<div class="listingblock">
1658<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111659<pre><code>$ git rebase -i --exec "make test"</code></pre>
Junio C Hamano644936c2012-06-28 23:05:141660</div></div>
1661<div class="paragraph"><p>This command lets you check that intermediate commits are compilable.
1662The todo list becomes like that:</p></div>
1663<div class="listingblock">
1664<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111665<pre><code>pick 5928aea one
Junio C Hamano644936c2012-06-28 23:05:141666exec make test
1667pick 04d0fda two
1668exec make test
1669pick ba46169 three
1670exec make test
1671pick f4593f9 four
Junio C Hamano9d971152012-12-19 00:43:111672exec make test</code></pre>
Junio C Hamano644936c2012-06-28 23:05:141673</div></div>
Junio C Hamano1d90cb02007-07-03 07:05:311674</div>
Junio C Hamano9d971152012-12-19 00:43:111675</div>
1676<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311677<h2 id="_splitting_commits">SPLITTING COMMITS</h2>
Junio C Hamanodbb64592007-09-01 11:17:391678<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591679<div class="paragraph"><p>In interactive mode, you can mark commits with the action "edit". However,
Junio C Hamano1aa40d22010-01-21 17:46:431680this does not necessarily mean that <em>git rebase</em> expects the result of this
Junio C Hamanodbb64592007-09-01 11:17:391681edit to be exactly one commit. Indeed, you can undo the commit, or you can
Junio C Hamanoba4b9282008-07-06 05:20:311682add other commits. This can be used to split a commit into two:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591683<div class="ulist"><ul>
Junio C Hamanodbb64592007-09-01 11:17:391684<li>
1685<p>
Junio C Hamano9d971152012-12-19 00:43:111686Start an interactive rebase with <code>git rebase -i &lt;commit&gt;^</code>, where
Junio C Hamanodbb64592007-09-01 11:17:391687 &lt;commit&gt; is the commit you want to split. In fact, any commit range
1688 will do, as long as it contains that commit.
1689</p>
1690</li>
1691<li>
1692<p>
1693Mark the commit you want to split with the action "edit".
1694</p>
1695</li>
1696<li>
1697<p>
Junio C Hamano9d971152012-12-19 00:43:111698When it comes to editing that commit, execute <code>git reset HEAD^</code>. The
Junio C Hamanodbb64592007-09-01 11:17:391699 effect is that the HEAD is rewound by one, and the index follows suit.
1700 However, the working tree stays the same.
1701</p>
1702</li>
1703<li>
1704<p>
1705Now add the changes to the index that you want to have in the first
Junio C Hamano9d971152012-12-19 00:43:111706 commit. You can use <code>git add</code> (possibly interactively) or
Junio C Hamano1aa40d22010-01-21 17:46:431707 <em>git gui</em> (or both) to do that.
Junio C Hamanodbb64592007-09-01 11:17:391708</p>
1709</li>
1710<li>
1711<p>
1712Commit the now-current index with whatever commit message is appropriate
1713 now.
1714</p>
1715</li>
1716<li>
1717<p>
1718Repeat the last two steps until your working tree is clean.
1719</p>
1720</li>
1721<li>
1722<p>
Junio C Hamano9d971152012-12-19 00:43:111723Continue the rebase with <code>git rebase --continue</code>.
Junio C Hamanodbb64592007-09-01 11:17:391724</p>
1725</li>
Junio C Hamanoba4b9282008-07-06 05:20:311726</ul></div>
Junio C Hamano68cf15a2010-11-06 01:01:591727<div class="paragraph"><p>If you are not absolutely sure that the intermediate revisions are
Junio C Hamanodbb64592007-09-01 11:17:391728consistent (they compile, pass the testsuite, etc.) you should use
Junio C Hamano1aa40d22010-01-21 17:46:431729<em>git stash</em> to stash away the not-yet-committed changes
Junio C Hamanoba4b9282008-07-06 05:20:311730after each commit, test, and amend the commit if fixes are necessary.</p></div>
Junio C Hamanodbb64592007-09-01 11:17:391731</div>
Junio C Hamano9d971152012-12-19 00:43:111732</div>
1733<div class="sect1">
Junio C Hamano7d06a8a2008-10-20 05:42:331734<h2 id="_recovering_from_upstream_rebase">RECOVERING FROM UPSTREAM REBASE</h2>
1735<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591736<div class="paragraph"><p>Rebasing (or any other form of rewriting) a branch that others have
Junio C Hamano7d06a8a2008-10-20 05:42:331737based work on is a bad idea: anyone downstream of it is forced to
1738manually fix their history. This section explains how to do the fix
Junio C Hamano68cf15a2010-11-06 01:01:591739from the downstream&#8217;s point of view. The real fix, however, would be
Junio C Hamano7d06a8a2008-10-20 05:42:331740to avoid rebasing the upstream in the first place.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591741<div class="paragraph"><p>To illustrate, suppose you are in a situation where someone develops a
Junio C Hamano7d06a8a2008-10-20 05:42:331742<em>subsystem</em> branch, and you are working on a <em>topic</em> that is dependent
1743on this <em>subsystem</em>. You might end up with a history like the
1744following:</p></div>
1745<div class="listingblock">
1746<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111747<pre><code> o---o---o---o---o---o---o---o---o master
Junio C Hamano7d06a8a2008-10-20 05:42:331748 \
1749 o---o---o---o---o subsystem
1750 \
Junio C Hamano9d971152012-12-19 00:43:111751 *---*---* topic</code></pre>
Junio C Hamano7d06a8a2008-10-20 05:42:331752</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591753<div class="paragraph"><p>If <em>subsystem</em> is rebased against <em>master</em>, the following happens:</p></div>
Junio C Hamano7d06a8a2008-10-20 05:42:331754<div class="listingblock">
1755<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111756<pre><code> o---o---o---o---o---o---o---o master
Junio C Hamano7d06a8a2008-10-20 05:42:331757 \ \
1758 o---o---o---o---o o'--o'--o'--o'--o' subsystem
1759 \
Junio C Hamano9d971152012-12-19 00:43:111760 *---*---* topic</code></pre>
Junio C Hamano7d06a8a2008-10-20 05:42:331761</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591762<div class="paragraph"><p>If you now continue development as usual, and eventually merge <em>topic</em>
Junio C Hamano7d06a8a2008-10-20 05:42:331763to <em>subsystem</em>, the commits from <em>subsystem</em> will remain duplicated forever:</p></div>
1764<div class="listingblock">
1765<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111766<pre><code> o---o---o---o---o---o---o---o master
Junio C Hamano7d06a8a2008-10-20 05:42:331767 \ \
1768 o---o---o---o---o o'--o'--o'--o'--o'--M subsystem
1769 \ /
Junio C Hamano9d971152012-12-19 00:43:111770 *---*---*-..........-*--* topic</code></pre>
Junio C Hamano7d06a8a2008-10-20 05:42:331771</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591772<div class="paragraph"><p>Such duplicates are generally frowned upon because they clutter up
Junio C Hamano7d06a8a2008-10-20 05:42:331773history, making it harder to follow. To clean things up, you need to
1774transplant the commits on <em>topic</em> to the new <em>subsystem</em> tip, i.e.,
1775rebase <em>topic</em>. This becomes a ripple effect: anyone downstream from
1776<em>topic</em> is forced to rebase too, and so on!</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591777<div class="paragraph"><p>There are two kinds of fixes, discussed in the following subsections:</p></div>
1778<div class="dlist"><dl>
1779<dt class="hdlist1">
Junio C Hamano7d06a8a2008-10-20 05:42:331780Easy case: The changes are literally the same.
1781</dt>
1782<dd>
1783<p>
1784 This happens if the <em>subsystem</em> rebase was a simple rebase and
1785 had no conflicts.
1786</p>
1787</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591788<dt class="hdlist1">
Junio C Hamano7d06a8a2008-10-20 05:42:331789Hard case: The changes are not the same.
1790</dt>
1791<dd>
1792<p>
1793 This happens if the <em>subsystem</em> rebase had conflicts, or used
Junio C Hamano9d971152012-12-19 00:43:111794 <code>--interactive</code> to omit, edit, squash, or fixup commits; or
1795 if the upstream used one of <code>commit --amend</code>, <code>reset</code>, or
1796 <code>filter-branch</code>.
Junio C Hamano7d06a8a2008-10-20 05:42:331797</p>
1798</dd>
1799</dl></div>
Junio C Hamano9d971152012-12-19 00:43:111800<div class="sect2">
1801<h3 id="_the_easy_case">The easy case</h3>
Junio C Hamano68cf15a2010-11-06 01:01:591802<div class="paragraph"><p>Only works if the changes (patch IDs based on the diff contents) on
Junio C Hamano7d06a8a2008-10-20 05:42:331803<em>subsystem</em> are literally the same before and after the rebase
1804<em>subsystem</em> did.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591805<div class="paragraph"><p>In that case, the fix is easy because <em>git rebase</em> knows to skip
Junio C Hamano7d06a8a2008-10-20 05:42:331806changes that are already present in the new upstream. So if you say
Junio C Hamano68cf15a2010-11-06 01:01:591807(assuming you&#8217;re on <em>topic</em>)</p></div>
Junio C Hamano7d06a8a2008-10-20 05:42:331808<div class="listingblock">
1809<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111810<pre><code> $ git rebase subsystem</code></pre>
Junio C Hamano7d06a8a2008-10-20 05:42:331811</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591812<div class="paragraph"><p>you will end up with the fixed history</p></div>
Junio C Hamano7d06a8a2008-10-20 05:42:331813<div class="listingblock">
1814<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111815<pre><code> o---o---o---o---o---o---o---o master
Junio C Hamano7d06a8a2008-10-20 05:42:331816 \
1817 o'--o'--o'--o'--o' subsystem
1818 \
Junio C Hamano9d971152012-12-19 00:43:111819 *---*---* topic</code></pre>
Junio C Hamano7d06a8a2008-10-20 05:42:331820</div></div>
Junio C Hamano9d971152012-12-19 00:43:111821</div>
1822<div class="sect2">
1823<h3 id="_the_hard_case">The hard case</h3>
Junio C Hamano68cf15a2010-11-06 01:01:591824<div class="paragraph"><p>Things get more complicated if the <em>subsystem</em> changes do not exactly
Junio C Hamano7d06a8a2008-10-20 05:42:331825correspond to the ones before the rebase.</p></div>
1826<div class="admonitionblock">
1827<table><tr>
1828<td class="icon">
1829<div class="title">Note</div>
1830</td>
1831<td class="content">While an "easy case recovery" sometimes appears to be successful
1832 even in the hard case, it may have unintended consequences. For
Junio C Hamano9d971152012-12-19 00:43:111833 example, a commit that was removed via <code>git rebase
1834 --interactive</code> will be <strong>resurrected</strong>!</td>
Junio C Hamano7d06a8a2008-10-20 05:42:331835</tr></table>
1836</div>
Junio C Hamano68cf15a2010-11-06 01:01:591837<div class="paragraph"><p>The idea is to manually tell <em>git rebase</em> "where the old <em>subsystem</em>
Junio C Hamano7d06a8a2008-10-20 05:42:331838ended and your <em>topic</em> began", that is, what the old merge-base
1839between them was. You will have to find a way to name the last commit
1840of the old <em>subsystem</em>, for example:</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591841<div class="ulist"><ul>
Junio C Hamano7d06a8a2008-10-20 05:42:331842<li>
1843<p>
Junio C Hamano1aa40d22010-01-21 17:46:431844With the <em>subsystem</em> reflog: after <em>git fetch</em>, the old tip of
Junio C Hamano9d971152012-12-19 00:43:111845 <em>subsystem</em> is at <code>subsystem@{1}</code>. Subsequent fetches will
Junio C Hamanoa28a9202012-06-21 07:08:231846 increase the number. (See <a href="git-reflog.html">git-reflog(1)</a>.)
Junio C Hamano7d06a8a2008-10-20 05:42:331847</p>
1848</li>
1849<li>
1850<p>
1851Relative to the tip of <em>topic</em>: knowing that your <em>topic</em> has three
Junio C Hamano9d971152012-12-19 00:43:111852 commits, the old tip of <em>subsystem</em> must be <code>topic~3</code>.
Junio C Hamano7d06a8a2008-10-20 05:42:331853</p>
1854</li>
1855</ul></div>
Junio C Hamano9d971152012-12-19 00:43:111856<div class="paragraph"><p>You can then transplant the old <code>subsystem..topic</code> to the new tip by
Junio C Hamano7d06a8a2008-10-20 05:42:331857saying (for the reflog case, and assuming you are on <em>topic</em> already):</p></div>
1858<div class="listingblock">
1859<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111860<pre><code> $ git rebase --onto subsystem subsystem@{1}</code></pre>
Junio C Hamano7d06a8a2008-10-20 05:42:331861</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591862<div class="paragraph"><p>The ripple effect of a "hard case" recovery is especially bad:
Junio C Hamano7d06a8a2008-10-20 05:42:331863<em>everyone</em> downstream from <em>topic</em> will now have to perform a "hard
1864case" recovery too!</p></div>
1865</div>
Junio C Hamano9d971152012-12-19 00:43:111866</div>
1867</div>
1868<div class="sect1">
Junio C Hamanobb88cf42010-06-21 15:23:551869<h2 id="_bugs">BUGS</h2>
1870<div class="sectionbody">
Junio C Hamano9d971152012-12-19 00:43:111871<div class="paragraph"><p>The todo list presented by <code>--preserve-merges --interactive</code> does not
Junio C Hamanobb88cf42010-06-21 15:23:551872represent the topology of the revision graph. Editing commits and
1873rewording their commit messages should work fine, but attempts to
1874reorder commits tend to produce counterintuitive results.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591875<div class="paragraph"><p>For example, an attempt to rearrange</p></div>
Junio C Hamanobb88cf42010-06-21 15:23:551876<div class="listingblock">
1877<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111878<pre><code>1 --- 2 --- 3 --- 4 --- 5</code></pre>
Junio C Hamanobb88cf42010-06-21 15:23:551879</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591880<div class="paragraph"><p>to</p></div>
Junio C Hamanobb88cf42010-06-21 15:23:551881<div class="listingblock">
1882<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111883<pre><code>1 --- 2 --- 4 --- 3 --- 5</code></pre>
Junio C Hamanobb88cf42010-06-21 15:23:551884</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591885<div class="paragraph"><p>by moving the "pick 4" line will result in the following history:</p></div>
Junio C Hamanobb88cf42010-06-21 15:23:551886<div class="listingblock">
1887<div class="content">
Junio C Hamano9d971152012-12-19 00:43:111888<pre><code> 3
Junio C Hamanobb88cf42010-06-21 15:23:551889 /
Junio C Hamano9d971152012-12-19 00:43:1118901 --- 2 --- 4 --- 5</code></pre>
Junio C Hamanobb88cf42010-06-21 15:23:551891</div></div>
1892</div>
Junio C Hamano9d971152012-12-19 00:43:111893</div>
1894<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311895<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231896<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231897<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231898</div>
Junio C Hamano7bd050f2011-09-22 06:32:221899</div>
Junio C Hamano9d971152012-12-19 00:43:111900</div>
Junio C Hamano7bd050f2011-09-22 06:32:221901<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:231902<div id="footer">
1903<div id="footer-text">
Junio C Hamano076ffcc2013-02-06 05:13:211904Last updated 2013-02-05 21:07:26 PST
Junio C Hamano1a4e8412005-12-27 08:17:231905</div>
1906</div>
1907</body>
1908</html>