Autogenerated HTML docs for v2.45.1-204-gd8ab1
[git-htmldocs.git] / git-rebase.html
blobae701ce45ec1a29805db7919be7abd7860ea9c7a
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5 <head>
6 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
7 <meta name="generator" content="AsciiDoc 10.2.0" />
8 <title>git-rebase(1)</title>
9 <style type="text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
12 /* Default font. */
13 body {
14 font-family: Georgia,serif;
17 /* Title font. */
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
21 #toctitle,
22 #author, #revnumber, #revdate, #revremark,
23 #footer {
24 font-family: Arial,Helvetica,sans-serif;
27 body {
28 margin: 1em 5% 1em 5%;
31 a {
32 color: blue;
33 text-decoration: underline;
35 a:visited {
36 color: fuchsia;
39 em {
40 font-style: italic;
41 color: navy;
44 strong {
45 font-weight: bold;
46 color: #083194;
49 h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
51 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
56 h1, h2, h3 {
57 border-bottom: 2px solid silver;
59 h2 {
60 padding-top: 0.5em;
62 h3 {
63 float: left;
65 h3 + * {
66 clear: left;
68 h5 {
69 font-size: 1.0em;
72 div.sectionbody {
73 margin-left: 0;
76 hr {
77 border: 1px solid silver;
80 p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
85 ul, ol, li > p {
86 margin-top: 0;
88 ul > li { color: #aaa; }
89 ul > li > * { color: black; }
91 .monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
95 padding: 0;
96 margin: 0;
98 pre {
99 white-space: pre-wrap;
102 #author {
103 color: #527bbd;
104 font-weight: bold;
105 font-size: 1.1em;
107 #email {
109 #revnumber, #revdate, #revremark {
112 #footer {
113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
118 #footer-text {
119 float: left;
120 padding-bottom: 0.5em;
122 #footer-badges {
123 float: right;
124 padding-bottom: 0.5em;
127 #preamble {
128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
134 margin-top: 1.0em;
135 margin-bottom: 1.5em;
137 div.admonitionblock {
138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
144 div.content { /* Block element content. */
145 padding: 0;
148 /* Block element titles. */
149 div.title, caption.title {
150 color: #527bbd;
151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
156 div.title + * {
157 margin-top: 0;
160 td div.title:first-child {
161 margin-top: 0.0em;
163 div.content div.title:first-child {
164 margin-top: 0.0em;
166 div.content + div.title {
167 margin-top: 0.0em;
170 div.sidebarblock > div.content {
171 background: #ffffee;
172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
174 padding: 0.5em;
177 div.listingblock > div.content {
178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
181 padding: 0.5em;
184 div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
187 margin-right: 10%;
188 border-left: 5px solid #f0f0f0;
189 color: #888;
192 div.quoteblock > div.attribution {
193 padding-top: 0.5em;
194 text-align: right;
197 div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
201 div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
205 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
207 text-align: left;
210 div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
218 div.admonitionblock td.content {
219 padding-left: 0.5em;
220 border-left: 3px solid #dddddd;
223 div.exampleblock > div.content {
224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
228 div.imageblock div.content { padding-left: 0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
232 dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
236 dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
239 font-style: normal;
240 color: navy;
242 dd > *:first-child {
243 margin-top: 0.1em;
246 ul, ol {
247 list-style-position: outside;
249 ol.arabic {
250 list-style-type: decimal;
252 ol.loweralpha {
253 list-style-type: lower-alpha;
255 ol.upperalpha {
256 list-style-type: upper-alpha;
258 ol.lowerroman {
259 list-style-type: lower-roman;
261 ol.upperroman {
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
272 tfoot {
273 font-weight: bold;
275 td > div.verse {
276 white-space: pre;
279 div.hdlist {
280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
283 div.hdlist tr {
284 padding-bottom: 15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
289 td.hdlist1 {
290 vertical-align: top;
291 font-style: normal;
292 padding-right: 0.8em;
293 color: navy;
295 td.hdlist2 {
296 vertical-align: top;
298 div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
303 .comment {
304 background: yellow;
307 .footnote, .footnoteref {
308 font-size: 0.8em;
311 span.footnote, span.footnoteref {
312 vertical-align: super;
315 #footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
320 #footnotes div.footnote {
321 margin: 0 0 5px 0;
324 #footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
334 div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
339 div.colist td img {
340 margin-top: 0.3em;
343 @media print {
344 #footer-badges { display: none; }
347 #toc {
348 margin-bottom: 2.5em;
351 #toctitle {
352 color: #527bbd;
353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
360 margin-top: 0;
361 margin-bottom: 0;
363 div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
367 div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
371 div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size: 2em; }
411 span.small { font-size: 0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
421 * xhtml11 specific
423 * */
425 div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
429 div.tableblock > table {
430 border: 3px solid #527bbd;
432 thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
436 p.table {
437 margin-top: 0;
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock > table[frame="void"] {
441 border-style: none;
443 div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
454 * html5 specific
456 * */
458 table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
462 thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
466 p.tableblock {
467 margin-top: 0;
469 table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
498 th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
501 th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
505 th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
517 * manpage specific
519 * */
521 body.manpage h1 {
522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
527 body.manpage h2 {
528 border-style: none;
530 body.manpage div.sectionbody {
531 margin-left: 3em;
534 @media print {
535 body.manpage div#toc { display: none; }
539 </style>
540 <script type="text/javascript">
541 /*<![CDATA[*/
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
552 * Version: 0.4
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
561 // toclevels = 1..4.
562 toc: function (toclevels) {
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
572 return text;
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
586 // browsers).
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
594 iterate(i);
598 iterate(el);
599 return result;
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
610 for (i = 0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute("class")
614 && entry.getAttribute("class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById("content"), toclevels);
623 for (var i = 0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id == "")
626 entry.element.id = "_toc_" + i;
627 var a = document.createElement("a");
628 a.href = "#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement("div");
631 div.appendChild(a);
632 div.className = "toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
650 var i;
651 var noteholder = document.getElementById("footnotes");
652 if (!noteholder) {
653 return;
655 var entriesToRemove = [];
656 for (i = 0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
659 entriesToRemove.push(entry);
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById("content");
667 var spans = cont.getElementsByTagName("span");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
673 var note = spans[i].getAttribute("data-note");
674 if (!note) {
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
678 spans[i].innerHTML =
679 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n + "</a>]";
681 spans[i].setAttribute("data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n + "'>" +
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
686 n + "</a>. " + note + "</div>";
687 var id =spans[i].getAttribute("id");
688 if (id != null) refs["#"+id] = n;
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
694 // Process footnoterefs.
695 for (i=0; i<spans.length; i++) {
696 if (spans[i].className == "footnoteref") {
697 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
698 href = href.match(/#.*/)[0]; // Because IE return full URL.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
708 install: function(toclevels) {
709 var timerId;
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
731 asciidoc.install();
732 /*]]>*/
733 </script>
734 </head>
735 <body class="manpage">
736 <div id="header">
737 <h1>
738 git-rebase(1) Manual Page
739 </h1>
740 <h2>NAME</h2>
741 <div class="sectionbody">
742 <p>git-rebase -
743 Reapply commits on top of another base tip
744 </p>
745 </div>
746 </div>
747 <div id="content">
748 <div class="sect1">
749 <h2 id="_synopsis">SYNOPSIS</h2>
750 <div class="sectionbody">
751 <div class="verseblock">
752 <pre class="content"><em>git rebase</em> [-i | --interactive] [&lt;options&gt;] [--exec &lt;cmd&gt;]
753 [--onto &lt;newbase&gt; | --keep-base] [&lt;upstream&gt; [&lt;branch&gt;]]
754 <em>git rebase</em> [-i | --interactive] [&lt;options&gt;] [--exec &lt;cmd&gt;] [--onto &lt;newbase&gt;]
755 --root [&lt;branch&gt;]
756 <em>git rebase</em> (--continue|--skip|--abort|--quit|--edit-todo|--show-current-patch)</pre>
757 <div class="attribution">
758 </div></div>
759 </div>
760 </div>
761 <div class="sect1">
762 <h2 id="_description">DESCRIPTION</h2>
763 <div class="sectionbody">
764 <div class="paragraph"><p>If <code>&lt;branch&gt;</code> is specified, <code>git rebase</code> will perform an automatic
765 <code>git switch &lt;branch&gt;</code> before doing anything else. Otherwise
766 it remains on the current branch.</p></div>
767 <div class="paragraph"><p>If <code>&lt;upstream&gt;</code> is not specified, the upstream configured in
768 <code>branch.&lt;name&gt;.remote</code> and <code>branch.&lt;name&gt;.merge</code> options will be used (see
769 <a href="git-config.html">git-config(1)</a> for details) and the <code>--fork-point</code> option is
770 assumed. If you are currently not on any branch or if the current
771 branch does not have a configured upstream, the rebase will abort.</p></div>
772 <div class="paragraph"><p>All changes made by commits in the current branch but that are not
773 in <code>&lt;upstream&gt;</code> are saved to a temporary area. This is the same set
774 of commits that would be shown by <code>git log &lt;upstream&gt;..HEAD</code>; or by
775 <code>git log 'fork_point'..HEAD</code>, if <code>--fork-point</code> is active (see the
776 description on <code>--fork-point</code> below); or by <code>git log HEAD</code>, if the
777 <code>--root</code> option is specified.</p></div>
778 <div class="paragraph"><p>The current branch is reset to <code>&lt;upstream&gt;</code> or <code>&lt;newbase&gt;</code> if the
779 <code>--onto</code> option was supplied. This has the exact same effect as
780 <code>git reset --hard &lt;upstream&gt;</code> (or <code>&lt;newbase&gt;</code>). <code>ORIG_HEAD</code> is set
781 to point at the tip of the branch before the reset.</p></div>
782 <div class="admonitionblock">
783 <table><tr>
784 <td class="icon">
785 <div class="title">Note</div>
786 </td>
787 <td class="content"><code>ORIG_HEAD</code> is not guaranteed to still point to the previous branch tip
788 at the end of the rebase if other commands that write that pseudo-ref
789 (e.g. <code>git reset</code>) are used during the rebase. The previous branch tip,
790 however, is accessible using the reflog of the current branch
791 (i.e. <code>@{1}</code>, see <a href="gitrevisions.html">gitrevisions(7)</a>).</td>
792 </tr></table>
793 </div>
794 <div class="paragraph"><p>The commits that were previously saved into the temporary area are
795 then reapplied to the current branch, one by one, in order. Note that
796 any commits in <code>HEAD</code> which introduce the same textual changes as a commit
797 in <code>HEAD..&lt;upstream&gt;</code> are omitted (i.e., a patch already accepted upstream
798 with a different commit message or timestamp will be skipped).</p></div>
799 <div class="paragraph"><p>It is possible that a merge failure will prevent this process from being
800 completely automatic. You will have to resolve any such merge failure
801 and run <code>git rebase --continue</code>. Another option is to bypass the commit
802 that caused the merge failure with <code>git rebase --skip</code>. To check out the
803 original <code>&lt;branch&gt;</code> and remove the <code>.git/rebase-apply</code> working files, use
804 the command <code>git rebase --abort</code> instead.</p></div>
805 <div class="paragraph"><p>Assume the following history exists and the current branch is "topic":</p></div>
806 <div class="listingblock">
807 <div class="content">
808 <pre><code> A---B---C topic
810 D---E---F---G master</code></pre>
811 </div></div>
812 <div class="paragraph"><p>From this point, the result of either of the following commands:</p></div>
813 <div class="literalblock">
814 <div class="content">
815 <pre><code>git rebase master
816 git rebase master topic</code></pre>
817 </div></div>
818 <div class="paragraph"><p>would be:</p></div>
819 <div class="listingblock">
820 <div class="content">
821 <pre><code> A'--B'--C' topic
823 D---E---F---G master</code></pre>
824 </div></div>
825 <div class="paragraph"><p><strong>NOTE:</strong> The latter form is just a short-hand of <code>git checkout topic</code>
826 followed by <code>git rebase master</code>. When rebase exits <code>topic</code> will
827 remain the checked-out branch.</p></div>
828 <div class="paragraph"><p>If the upstream branch already contains a change you have made (e.g.,
829 because you mailed a patch which was applied upstream), then that commit
830 will be skipped and warnings will be issued (if the <em>merge</em> backend is
831 used). For example, running <code>git rebase master</code> on the following
832 history (in which <code>A'</code> and <code>A</code> introduce the same set of changes, but
833 have different committer information):</p></div>
834 <div class="listingblock">
835 <div class="content">
836 <pre><code> A---B---C topic
838 D---E---A'---F master</code></pre>
839 </div></div>
840 <div class="paragraph"><p>will result in:</p></div>
841 <div class="listingblock">
842 <div class="content">
843 <pre><code> B'---C' topic
845 D---E---A'---F master</code></pre>
846 </div></div>
847 <div class="paragraph"><p>Here is how you would transplant a topic branch based on one
848 branch to another, to pretend that you forked the topic branch
849 from the latter branch, using <code>rebase --onto</code>.</p></div>
850 <div class="paragraph"><p>First let&#8217;s assume your <em>topic</em> is based on branch <em>next</em>.
851 For example, a feature developed in <em>topic</em> depends on some
852 functionality which is found in <em>next</em>.</p></div>
853 <div class="listingblock">
854 <div class="content">
855 <pre><code> o---o---o---o---o master
857 o---o---o---o---o next
859 o---o---o topic</code></pre>
860 </div></div>
861 <div class="paragraph"><p>We want to make <em>topic</em> forked from branch <em>master</em>; for example,
862 because the functionality on which <em>topic</em> depends was merged into the
863 more stable <em>master</em> branch. We want our tree to look like this:</p></div>
864 <div class="listingblock">
865 <div class="content">
866 <pre><code> o---o---o---o---o master
868 | o'--o'--o' topic
870 o---o---o---o---o next</code></pre>
871 </div></div>
872 <div class="paragraph"><p>We can get this using the following command:</p></div>
873 <div class="literalblock">
874 <div class="content">
875 <pre><code>git rebase --onto master next topic</code></pre>
876 </div></div>
877 <div class="paragraph"><p>Another example of --onto option is to rebase part of a
878 branch. If we have the following situation:</p></div>
879 <div class="listingblock">
880 <div class="content">
881 <pre><code> H---I---J topicB
883 E---F---G topicA
885 A---B---C---D master</code></pre>
886 </div></div>
887 <div class="paragraph"><p>then the command</p></div>
888 <div class="literalblock">
889 <div class="content">
890 <pre><code>git rebase --onto master topicA topicB</code></pre>
891 </div></div>
892 <div class="paragraph"><p>would result in:</p></div>
893 <div class="listingblock">
894 <div class="content">
895 <pre><code> H'--I'--J' topicB
897 | E---F---G topicA
899 A---B---C---D master</code></pre>
900 </div></div>
901 <div class="paragraph"><p>This is useful when topicB does not depend on topicA.</p></div>
902 <div class="paragraph"><p>A range of commits could also be removed with rebase. If we have
903 the following situation:</p></div>
904 <div class="listingblock">
905 <div class="content">
906 <pre><code> E---F---G---H---I---J topicA</code></pre>
907 </div></div>
908 <div class="paragraph"><p>then the command</p></div>
909 <div class="literalblock">
910 <div class="content">
911 <pre><code>git rebase --onto topicA~5 topicA~3 topicA</code></pre>
912 </div></div>
913 <div class="paragraph"><p>would result in the removal of commits F and G:</p></div>
914 <div class="listingblock">
915 <div class="content">
916 <pre><code> E---H'---I'---J' topicA</code></pre>
917 </div></div>
918 <div class="paragraph"><p>This is useful if F and G were flawed in some way, or should not be
919 part of topicA. Note that the argument to <code>--onto</code> and the <code>&lt;upstream&gt;</code>
920 parameter can be any valid commit-ish.</p></div>
921 <div class="paragraph"><p>In case of conflict, <code>git rebase</code> will stop at the first problematic commit
922 and leave conflict markers in the tree. You can use <code>git diff</code> to locate
923 the markers (&lt;&lt;&lt;&lt;&lt;&lt;) and make edits to resolve the conflict. For each
924 file you edit, you need to tell Git that the conflict has been resolved,
925 typically this would be done with</p></div>
926 <div class="literalblock">
927 <div class="content">
928 <pre><code>git add &lt;filename&gt;</code></pre>
929 </div></div>
930 <div class="paragraph"><p>After resolving the conflict manually and updating the index with the
931 desired resolution, you can continue the rebasing process with</p></div>
932 <div class="literalblock">
933 <div class="content">
934 <pre><code>git rebase --continue</code></pre>
935 </div></div>
936 <div class="paragraph"><p>Alternatively, you can undo the <em>git rebase</em> with</p></div>
937 <div class="literalblock">
938 <div class="content">
939 <pre><code>git rebase --abort</code></pre>
940 </div></div>
941 </div>
942 </div>
943 <div class="sect1">
944 <h2 id="_mode_options">MODE OPTIONS</h2>
945 <div class="sectionbody">
946 <div class="paragraph"><p>The options in this section cannot be used with any other option,
947 including not with each other:</p></div>
948 <div class="dlist"><dl>
949 <dt class="hdlist1">
950 --continue
951 </dt>
952 <dd>
954 Restart the rebasing process after having resolved a merge conflict.
955 </p>
956 </dd>
957 <dt class="hdlist1">
958 --skip
959 </dt>
960 <dd>
962 Restart the rebasing process by skipping the current patch.
963 </p>
964 </dd>
965 <dt class="hdlist1">
966 --abort
967 </dt>
968 <dd>
970 Abort the rebase operation and reset HEAD to the original
971 branch. If <code>&lt;branch&gt;</code> was provided when the rebase operation was
972 started, then <code>HEAD</code> will be reset to <code>&lt;branch&gt;</code>. Otherwise <code>HEAD</code>
973 will be reset to where it was when the rebase operation was
974 started.
975 </p>
976 </dd>
977 <dt class="hdlist1">
978 --quit
979 </dt>
980 <dd>
982 Abort the rebase operation but <code>HEAD</code> is not reset back to the
983 original branch. The index and working tree are also left
984 unchanged as a result. If a temporary stash entry was created
985 using <code>--autostash</code>, it will be saved to the stash list.
986 </p>
987 </dd>
988 <dt class="hdlist1">
989 --edit-todo
990 </dt>
991 <dd>
993 Edit the todo list during an interactive rebase.
994 </p>
995 </dd>
996 <dt class="hdlist1">
997 --show-current-patch
998 </dt>
999 <dd>
1001 Show the current patch in an interactive rebase or when rebase
1002 is stopped because of conflicts. This is the equivalent of
1003 <code>git show REBASE_HEAD</code>.
1004 </p>
1005 </dd>
1006 </dl></div>
1007 </div>
1008 </div>
1009 <div class="sect1">
1010 <h2 id="_options">OPTIONS</h2>
1011 <div class="sectionbody">
1012 <div class="dlist"><dl>
1013 <dt class="hdlist1">
1014 --onto &lt;newbase&gt;
1015 </dt>
1016 <dd>
1018 Starting point at which to create the new commits. If the
1019 <code>--onto</code> option is not specified, the starting point is
1020 <code>&lt;upstream&gt;</code>. May be any valid commit, and not just an
1021 existing branch name.
1022 </p>
1023 <div class="paragraph"><p>As a special case, you may use "A...B" as a shortcut for the
1024 merge base of A and B if there is exactly one merge base. You can
1025 leave out at most one of A and B, in which case it defaults to HEAD.</p></div>
1026 </dd>
1027 <dt class="hdlist1">
1028 --keep-base
1029 </dt>
1030 <dd>
1032 Set the starting point at which to create the new commits to the
1033 merge base of <code>&lt;upstream&gt;</code> and <code>&lt;branch&gt;</code>. Running
1034 <code>git rebase --keep-base &lt;upstream&gt; &lt;branch&gt;</code> is equivalent to
1035 running
1036 <code>git rebase --reapply-cherry-picks --no-fork-point --onto &lt;upstream&gt;...&lt;branch&gt; &lt;upstream&gt; &lt;branch&gt;</code>.
1037 </p>
1038 <div class="paragraph"><p>This option is useful in the case where one is developing a feature on
1039 top of an upstream branch. While the feature is being worked on, the
1040 upstream branch may advance and it may not be the best idea to keep
1041 rebasing on top of the upstream but to keep the base commit as-is. As
1042 the base commit is unchanged this option implies <code>--reapply-cherry-picks</code>
1043 to avoid losing commits.</p></div>
1044 <div class="paragraph"><p>Although both this option and <code>--fork-point</code> find the merge base between
1045 <code>&lt;upstream&gt;</code> and <code>&lt;branch&gt;</code>, this option uses the merge base as the <em>starting
1046 point</em> on which new commits will be created, whereas <code>--fork-point</code> uses
1047 the merge base to determine the <em>set of commits</em> which will be rebased.</p></div>
1048 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1049 </dd>
1050 <dt class="hdlist1">
1051 &lt;upstream&gt;
1052 </dt>
1053 <dd>
1055 Upstream branch to compare against. May be any valid commit,
1056 not just an existing branch name. Defaults to the configured
1057 upstream for the current branch.
1058 </p>
1059 </dd>
1060 <dt class="hdlist1">
1061 &lt;branch&gt;
1062 </dt>
1063 <dd>
1065 Working branch; defaults to <code>HEAD</code>.
1066 </p>
1067 </dd>
1068 <dt class="hdlist1">
1069 --apply
1070 </dt>
1071 <dd>
1073 Use applying strategies to rebase (calling <code>git-am</code>
1074 internally). This option may become a no-op in the future
1075 once the merge backend handles everything the apply one does.
1076 </p>
1077 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1078 </dd>
1079 <dt class="hdlist1">
1080 --empty=(drop|keep|stop)
1081 </dt>
1082 <dd>
1084 How to handle commits that are not empty to start and are not
1085 clean cherry-picks of any upstream commit, but which become
1086 empty after rebasing (because they contain a subset of already
1087 upstream changes):
1088 </p>
1089 <div class="openblock">
1090 <div class="content">
1091 <div class="dlist"><dl>
1092 <dt class="hdlist1">
1093 <code>drop</code>
1094 </dt>
1095 <dd>
1097 The commit will be dropped. This is the default behavior.
1098 </p>
1099 </dd>
1100 <dt class="hdlist1">
1101 <code>keep</code>
1102 </dt>
1103 <dd>
1105 The commit will be kept. This option is implied when <code>--exec</code> is
1106 specified unless <code>-i</code>/<code>--interactive</code> is also specified.
1107 </p>
1108 </dd>
1109 <dt class="hdlist1">
1110 <code>stop</code>
1111 </dt>
1112 <dt class="hdlist1">
1113 <code>ask</code>
1114 </dt>
1115 <dd>
1117 The rebase will halt when the commit is applied, allowing you to
1118 choose whether to drop it, edit files more, or just commit the empty
1119 changes. This option is implied when <code>-i</code>/<code>--interactive</code> is
1120 specified. <code>ask</code> is a deprecated synonym of <code>stop</code>.
1121 </p>
1122 </dd>
1123 </dl></div>
1124 </div></div>
1125 <div class="paragraph"><p>Note that commits which start empty are kept (unless <code>--no-keep-empty</code>
1126 is specified), and commits which are clean cherry-picks (as determined
1127 by <code>git log --cherry-mark ...</code>) are detected and dropped as a
1128 preliminary step (unless <code>--reapply-cherry-picks</code> or <code>--keep-base</code> is
1129 passed).</p></div>
1130 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1131 </dd>
1132 <dt class="hdlist1">
1133 --no-keep-empty
1134 </dt>
1135 <dt class="hdlist1">
1136 --keep-empty
1137 </dt>
1138 <dd>
1140 Do not keep commits that start empty before the rebase
1141 (i.e. that do not change anything from its parent) in the
1142 result. The default is to keep commits which start empty,
1143 since creating such commits requires passing the <code>--allow-empty</code>
1144 override flag to <code>git commit</code>, signifying that a user is very
1145 intentionally creating such a commit and thus wants to keep
1147 </p>
1148 <div class="paragraph"><p>Usage of this flag will probably be rare, since you can get rid of
1149 commits that start empty by just firing up an interactive rebase and
1150 removing the lines corresponding to the commits you don&#8217;t want. This
1151 flag exists as a convenient shortcut, such as for cases where external
1152 tools generate many empty commits and you want them all removed.</p></div>
1153 <div class="paragraph"><p>For commits which do not start empty but become empty after rebasing,
1154 see the <code>--empty</code> flag.</p></div>
1155 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1156 </dd>
1157 <dt class="hdlist1">
1158 --reapply-cherry-picks
1159 </dt>
1160 <dt class="hdlist1">
1161 --no-reapply-cherry-picks
1162 </dt>
1163 <dd>
1165 Reapply all clean cherry-picks of any upstream commit instead
1166 of preemptively dropping them. (If these commits then become
1167 empty after rebasing, because they contain a subset of already
1168 upstream changes, the behavior towards them is controlled by
1169 the <code>--empty</code> flag.)
1170 </p>
1171 <div class="paragraph"><p>In the absence of <code>--keep-base</code> (or if <code>--no-reapply-cherry-picks</code> is
1172 given), these commits will be automatically dropped. Because this
1173 necessitates reading all upstream commits, this can be expensive in
1174 repositories with a large number of upstream commits that need to be
1175 read. When using the <em>merge</em> backend, warnings will be issued for each
1176 dropped commit (unless <code>--quiet</code> is given). Advice will also be issued
1177 unless <code>advice.skippedCherryPicks</code> is set to false (see
1178 <a href="git-config.html">git-config(1)</a>).</p></div>
1179 <div class="paragraph"><p><code>--reapply-cherry-picks</code> allows rebase to forgo reading all upstream
1180 commits, potentially improving performance.</p></div>
1181 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1182 </dd>
1183 <dt class="hdlist1">
1184 --allow-empty-message
1185 </dt>
1186 <dd>
1188 No-op. Rebasing commits with an empty message used to fail
1189 and this option would override that behavior, allowing commits
1190 with empty messages to be rebased. Now commits with an empty
1191 message do not cause rebasing to halt.
1192 </p>
1193 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1194 </dd>
1195 <dt class="hdlist1">
1197 </dt>
1198 <dt class="hdlist1">
1199 --merge
1200 </dt>
1201 <dd>
1203 Using merging strategies to rebase (default).
1204 </p>
1205 <div class="paragraph"><p>Note that a rebase merge works by replaying each commit from the working
1206 branch on top of the <code>&lt;upstream&gt;</code> branch. Because of this, when a merge
1207 conflict happens, the side reported as <em>ours</em> is the so-far rebased
1208 series, starting with <code>&lt;upstream&gt;</code>, and <em>theirs</em> is the working branch.
1209 In other words, the sides are swapped.</p></div>
1210 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1211 </dd>
1212 <dt class="hdlist1">
1213 -s &lt;strategy&gt;
1214 </dt>
1215 <dt class="hdlist1">
1216 --strategy=&lt;strategy&gt;
1217 </dt>
1218 <dd>
1220 Use the given merge strategy, instead of the default <code>ort</code>.
1221 This implies <code>--merge</code>.
1222 </p>
1223 <div class="paragraph"><p>Because <code>git rebase</code> replays each commit from the working branch
1224 on top of the <code>&lt;upstream&gt;</code> branch using the given strategy, using
1225 the <code>ours</code> strategy simply empties all patches from the <code>&lt;branch&gt;</code>,
1226 which makes little sense.</p></div>
1227 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1228 </dd>
1229 <dt class="hdlist1">
1230 -X &lt;strategy-option&gt;
1231 </dt>
1232 <dt class="hdlist1">
1233 --strategy-option=&lt;strategy-option&gt;
1234 </dt>
1235 <dd>
1237 Pass the &lt;strategy-option&gt; through to the merge strategy.
1238 This implies <code>--merge</code> and, if no strategy has been
1239 specified, <code>-s ort</code>. Note the reversal of <em>ours</em> and
1240 <em>theirs</em> as noted above for the <code>-m</code> option.
1241 </p>
1242 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1243 </dd>
1244 <dt class="hdlist1">
1245 --rerere-autoupdate
1246 </dt>
1247 <dt class="hdlist1">
1248 --no-rerere-autoupdate
1249 </dt>
1250 <dd>
1252 After the rerere mechanism reuses a recorded resolution on
1253 the current conflict to update the files in the working
1254 tree, allow it to also update the index with the result of
1255 resolution. <code>--no-rerere-autoupdate</code> is a good way to
1256 double-check what <code>rerere</code> did and catch potential
1257 mismerges, before committing the result to the index with a
1258 separate <code>git add</code>.
1259 </p>
1260 </dd>
1261 <dt class="hdlist1">
1262 -S[&lt;keyid&gt;]
1263 </dt>
1264 <dt class="hdlist1">
1265 --gpg-sign[=&lt;keyid&gt;]
1266 </dt>
1267 <dt class="hdlist1">
1268 --no-gpg-sign
1269 </dt>
1270 <dd>
1272 GPG-sign commits. The <code>keyid</code> argument is optional and
1273 defaults to the committer identity; if specified, it must be
1274 stuck to the option without a space. <code>--no-gpg-sign</code> is useful to
1275 countermand both <code>commit.gpgSign</code> configuration variable, and
1276 earlier <code>--gpg-sign</code>.
1277 </p>
1278 </dd>
1279 <dt class="hdlist1">
1281 </dt>
1282 <dt class="hdlist1">
1283 --quiet
1284 </dt>
1285 <dd>
1287 Be quiet. Implies <code>--no-stat</code>.
1288 </p>
1289 </dd>
1290 <dt class="hdlist1">
1292 </dt>
1293 <dt class="hdlist1">
1294 --verbose
1295 </dt>
1296 <dd>
1298 Be verbose. Implies <code>--stat</code>.
1299 </p>
1300 </dd>
1301 <dt class="hdlist1">
1302 --stat
1303 </dt>
1304 <dd>
1306 Show a diffstat of what changed upstream since the last rebase. The
1307 diffstat is also controlled by the configuration option rebase.stat.
1308 </p>
1309 </dd>
1310 <dt class="hdlist1">
1312 </dt>
1313 <dt class="hdlist1">
1314 --no-stat
1315 </dt>
1316 <dd>
1318 Do not show a diffstat as part of the rebase process.
1319 </p>
1320 </dd>
1321 <dt class="hdlist1">
1322 --no-verify
1323 </dt>
1324 <dd>
1326 This option bypasses the pre-rebase hook. See also <a href="githooks.html">githooks(5)</a>.
1327 </p>
1328 </dd>
1329 <dt class="hdlist1">
1330 --verify
1331 </dt>
1332 <dd>
1334 Allows the pre-rebase hook to run, which is the default. This option can
1335 be used to override <code>--no-verify</code>. See also <a href="githooks.html">githooks(5)</a>.
1336 </p>
1337 </dd>
1338 <dt class="hdlist1">
1339 -C&lt;n&gt;
1340 </dt>
1341 <dd>
1343 Ensure at least <code>&lt;n&gt;</code> lines of surrounding context match before
1344 and after each change. When fewer lines of surrounding
1345 context exist they all must match. By default no context is
1346 ever ignored. Implies <code>--apply</code>.
1347 </p>
1348 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1349 </dd>
1350 <dt class="hdlist1">
1351 --no-ff
1352 </dt>
1353 <dt class="hdlist1">
1354 --force-rebase
1355 </dt>
1356 <dt class="hdlist1">
1358 </dt>
1359 <dd>
1361 Individually replay all rebased commits instead of fast-forwarding
1362 over the unchanged ones. This ensures that the entire history of
1363 the rebased branch is composed of new commits.
1364 </p>
1365 <div class="paragraph"><p>You may find this helpful after reverting a topic branch merge, as this option
1366 recreates the topic branch with fresh commits so it can be remerged
1367 successfully without needing to "revert the reversion" (see the
1368 <a href="howto/revert-a-faulty-merge.html">revert-a-faulty-merge How-To</a> for
1369 details).</p></div>
1370 </dd>
1371 <dt class="hdlist1">
1372 --fork-point
1373 </dt>
1374 <dt class="hdlist1">
1375 --no-fork-point
1376 </dt>
1377 <dd>
1379 Use reflog to find a better common ancestor between <code>&lt;upstream&gt;</code>
1380 and <code>&lt;branch&gt;</code> when calculating which commits have been
1381 introduced by <code>&lt;branch&gt;</code>.
1382 </p>
1383 <div class="paragraph"><p>When <code>--fork-point</code> is active, <em>fork_point</em> will be used instead of
1384 <code>&lt;upstream&gt;</code> to calculate the set of commits to rebase, where
1385 <em>fork_point</em> is the result of <code>git merge-base --fork-point &lt;upstream&gt;
1386 &lt;branch&gt;</code> command (see <a href="git-merge-base.html">git-merge-base(1)</a>). If <em>fork_point</em>
1387 ends up being empty, the <code>&lt;upstream&gt;</code> will be used as a fallback.</p></div>
1388 <div class="paragraph"><p>If <code>&lt;upstream&gt;</code> or <code>--keep-base</code> is given on the command line, then
1389 the default is <code>--no-fork-point</code>, otherwise the default is
1390 <code>--fork-point</code>. See also <code>rebase.forkpoint</code> in <a href="git-config.html">git-config(1)</a>.</p></div>
1391 <div class="paragraph"><p>If your branch was based on <code>&lt;upstream&gt;</code> but <code>&lt;upstream&gt;</code> was rewound and
1392 your branch contains commits which were dropped, this option can be used
1393 with <code>--keep-base</code> in order to drop those commits from your branch.</p></div>
1394 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1395 </dd>
1396 <dt class="hdlist1">
1397 --ignore-whitespace
1398 </dt>
1399 <dd>
1401 Ignore whitespace differences when trying to reconcile
1402 differences. Currently, each backend implements an approximation of
1403 this behavior:
1404 </p>
1405 <div class="dlist"><dl>
1406 <dt class="hdlist1">
1407 apply backend
1408 </dt>
1409 <dd>
1411 When applying a patch, ignore changes in whitespace in context
1412 lines. Unfortunately, this means that if the "old" lines being
1413 replaced by the patch differ only in whitespace from the existing
1414 file, you will get a merge conflict instead of a successful patch
1415 application.
1416 </p>
1417 </dd>
1418 <dt class="hdlist1">
1419 merge backend
1420 </dt>
1421 <dd>
1423 Treat lines with only whitespace changes as unchanged when merging.
1424 Unfortunately, this means that any patch hunks that were intended
1425 to modify whitespace and nothing else will be dropped, even if the
1426 other side had no changes that conflicted.
1427 </p>
1428 </dd>
1429 </dl></div>
1430 </dd>
1431 <dt class="hdlist1">
1432 --whitespace=&lt;option&gt;
1433 </dt>
1434 <dd>
1436 This flag is passed to the <code>git apply</code> program
1437 (see <a href="git-apply.html">git-apply(1)</a>) that applies the patch.
1438 Implies <code>--apply</code>.
1439 </p>
1440 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1441 </dd>
1442 <dt class="hdlist1">
1443 --committer-date-is-author-date
1444 </dt>
1445 <dd>
1447 Instead of using the current time as the committer date, use
1448 the author date of the commit being rebased as the committer
1449 date. This option implies <code>--force-rebase</code>.
1450 </p>
1451 </dd>
1452 <dt class="hdlist1">
1453 --ignore-date
1454 </dt>
1455 <dt class="hdlist1">
1456 --reset-author-date
1457 </dt>
1458 <dd>
1460 Instead of using the author date of the original commit, use
1461 the current time as the author date of the rebased commit. This
1462 option implies <code>--force-rebase</code>.
1463 </p>
1464 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1465 </dd>
1466 <dt class="hdlist1">
1467 --signoff
1468 </dt>
1469 <dd>
1471 Add a <code>Signed-off-by</code> trailer to all the rebased commits. Note
1472 that if <code>--interactive</code> is given then only commits marked to be
1473 picked, edited or reworded will have the trailer added.
1474 </p>
1475 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1476 </dd>
1477 <dt class="hdlist1">
1479 </dt>
1480 <dt class="hdlist1">
1481 --interactive
1482 </dt>
1483 <dd>
1485 Make a list of the commits which are about to be rebased. Let the
1486 user edit that list before rebasing. This mode can also be used to
1487 split commits (see SPLITTING COMMITS below).
1488 </p>
1489 <div class="paragraph"><p>The commit list format can be changed by setting the configuration option
1490 rebase.instructionFormat. A customized instruction format will automatically
1491 have the commit hash prepended to the format.</p></div>
1492 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1493 </dd>
1494 <dt class="hdlist1">
1496 </dt>
1497 <dt class="hdlist1">
1498 --rebase-merges[=(rebase-cousins|no-rebase-cousins)]
1499 </dt>
1500 <dt class="hdlist1">
1501 --no-rebase-merges
1502 </dt>
1503 <dd>
1505 By default, a rebase will simply drop merge commits from the todo
1506 list, and put the rebased commits into a single, linear branch.
1507 With <code>--rebase-merges</code>, the rebase will instead try to preserve
1508 the branching structure within the commits that are to be rebased,
1509 by recreating the merge commits. Any resolved merge conflicts or
1510 manual amendments in these merge commits will have to be
1511 resolved/re-applied manually. <code>--no-rebase-merges</code> can be used to
1512 countermand both the <code>rebase.rebaseMerges</code> config option and a previous
1513 <code>--rebase-merges</code>.
1514 </p>
1515 <div class="paragraph"><p>When rebasing merges, there are two modes: <code>rebase-cousins</code> and
1516 <code>no-rebase-cousins</code>. If the mode is not specified, it defaults to
1517 <code>no-rebase-cousins</code>. In <code>no-rebase-cousins</code> mode, commits which do not have
1518 <code>&lt;upstream&gt;</code> as direct ancestor will keep their original branch point, i.e.
1519 commits that would be excluded by <a href="git-log.html">git-log(1)</a>'s <code>--ancestry-path</code>
1520 option will keep their original ancestry by default. In <code>rebase-cousins</code> mode,
1521 such commits are instead rebased onto <code>&lt;upstream&gt;</code> (or <code>&lt;onto&gt;</code>, if
1522 specified).</p></div>
1523 <div class="paragraph"><p>It is currently only possible to recreate the merge commits using the
1524 <code>ort</code> merge strategy; different merge strategies can be used only via
1525 explicit <code>exec git merge -s &lt;strategy&gt; [...]</code> commands.</p></div>
1526 <div class="paragraph"><p>See also REBASING MERGES and INCOMPATIBLE OPTIONS below.</p></div>
1527 </dd>
1528 <dt class="hdlist1">
1529 -x &lt;cmd&gt;
1530 </dt>
1531 <dt class="hdlist1">
1532 --exec &lt;cmd&gt;
1533 </dt>
1534 <dd>
1536 Append "exec &lt;cmd&gt;" after each line creating a commit in the
1537 final history. <code>&lt;cmd&gt;</code> will be interpreted as one or more shell
1538 commands. Any command that fails will interrupt the rebase,
1539 with exit code 1.
1540 </p>
1541 <div class="paragraph"><p>You may execute several commands by either using one instance of <code>--exec</code>
1542 with several commands:</p></div>
1543 <div class="literalblock">
1544 <div class="content">
1545 <pre><code>git rebase -i --exec "cmd1 &amp;&amp; cmd2 &amp;&amp; ..."</code></pre>
1546 </div></div>
1547 <div class="paragraph"><p>or by giving more than one <code>--exec</code>:</p></div>
1548 <div class="literalblock">
1549 <div class="content">
1550 <pre><code>git rebase -i --exec "cmd1" --exec "cmd2" --exec ...</code></pre>
1551 </div></div>
1552 <div class="paragraph"><p>If <code>--autosquash</code> is used, <code>exec</code> lines will not be appended for
1553 the intermediate commits, and will only appear at the end of each
1554 squash/fixup series.</p></div>
1555 <div class="paragraph"><p>This uses the <code>--interactive</code> machinery internally, but it can be run
1556 without an explicit <code>--interactive</code>.</p></div>
1557 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1558 </dd>
1559 <dt class="hdlist1">
1560 --root
1561 </dt>
1562 <dd>
1564 Rebase all commits reachable from <code>&lt;branch&gt;</code>, instead of
1565 limiting them with an <code>&lt;upstream&gt;</code>. This allows you to rebase
1566 the root commit(s) on a branch.
1567 </p>
1568 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1569 </dd>
1570 <dt class="hdlist1">
1571 --autosquash
1572 </dt>
1573 <dt class="hdlist1">
1574 --no-autosquash
1575 </dt>
1576 <dd>
1578 Automatically squash commits with specially formatted messages into
1579 previous commits being rebased. If a commit message starts with
1580 "squash! ", "fixup! " or "amend! ", the remainder of the subject line
1581 is taken as a commit specifier, which matches a previous commit if it
1582 matches the subject line or the hash of that commit. If no commit
1583 matches fully, matches of the specifier with the start of commit
1584 subjects are considered.
1585 </p>
1586 <div class="paragraph"><p>In the rebase todo list, the actions of squash, fixup and amend commits are
1587 changed from <code>pick</code> to <code>squash</code>, <code>fixup</code> or <code>fixup -C</code>, respectively, and they
1588 are moved right after the commit they modify. The <code>--interactive</code> option can
1589 be used to review and edit the todo list before proceeding.</p></div>
1590 <div class="paragraph"><p>The recommended way to create commits with squash markers is by using the
1591 <code>--squash</code>, <code>--fixup</code>, <code>--fixup=amend:</code> or <code>--fixup=reword:</code> options of
1592 <a href="git-commit.html">git-commit(1)</a>, which take the target commit as an argument and
1593 automatically fill in the subject line of the new commit from that.</p></div>
1594 <div class="paragraph"><p>Setting configuration variable <code>rebase.autoSquash</code> to true enables
1595 auto-squashing by default for interactive rebase. The <code>--no-autosquash</code>
1596 option can be used to override that setting.</p></div>
1597 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1598 </dd>
1599 <dt class="hdlist1">
1600 --autostash
1601 </dt>
1602 <dt class="hdlist1">
1603 --no-autostash
1604 </dt>
1605 <dd>
1607 Automatically create a temporary stash entry before the operation
1608 begins, and apply it after the operation ends. This means
1609 that you can run rebase on a dirty worktree. However, use
1610 with care: the final stash application after a successful
1611 rebase might result in non-trivial conflicts.
1612 </p>
1613 </dd>
1614 <dt class="hdlist1">
1615 --reschedule-failed-exec
1616 </dt>
1617 <dt class="hdlist1">
1618 --no-reschedule-failed-exec
1619 </dt>
1620 <dd>
1622 Automatically reschedule <code>exec</code> commands that failed. This only makes
1623 sense in interactive mode (or when an <code>--exec</code> option was provided).
1624 </p>
1625 <div class="paragraph"><p>This option applies once a rebase is started. It is preserved for the whole
1626 rebase based on, in order, the command line option provided to the initial <code>git
1627 rebase</code>, the <code>rebase.rescheduleFailedExec</code> configuration (see
1628 <a href="git-config.html">git-config(1)</a> or "CONFIGURATION" below), or it defaults to false.</p></div>
1629 <div class="paragraph"><p>Recording this option for the whole rebase is a convenience feature. Otherwise
1630 an explicit <code>--no-reschedule-failed-exec</code> at the start would be overridden by
1631 the presence of a <code>rebase.rescheduleFailedExec=true</code> configuration when <code>git
1632 rebase --continue</code> is invoked. Currently, you cannot pass
1633 <code>--[no-]reschedule-failed-exec</code> to <code>git rebase --continue</code>.</p></div>
1634 </dd>
1635 <dt class="hdlist1">
1636 --update-refs
1637 </dt>
1638 <dt class="hdlist1">
1639 --no-update-refs
1640 </dt>
1641 <dd>
1643 Automatically force-update any branches that point to commits that
1644 are being rebased. Any branches that are checked out in a worktree
1645 are not updated in this way.
1646 </p>
1647 <div class="paragraph"><p>If the configuration variable <code>rebase.updateRefs</code> is set, then this option
1648 can be used to override and disable this setting.</p></div>
1649 <div class="paragraph"><p>See also INCOMPATIBLE OPTIONS below.</p></div>
1650 </dd>
1651 </dl></div>
1652 </div>
1653 </div>
1654 <div class="sect1">
1655 <h2 id="_incompatible_options">INCOMPATIBLE OPTIONS</h2>
1656 <div class="sectionbody">
1657 <div class="paragraph"><p>The following options:</p></div>
1658 <div class="ulist"><ul>
1659 <li>
1661 --apply
1662 </p>
1663 </li>
1664 <li>
1666 --whitespace
1667 </p>
1668 </li>
1669 <li>
1672 </p>
1673 </li>
1674 </ul></div>
1675 <div class="paragraph"><p>are incompatible with the following options:</p></div>
1676 <div class="ulist"><ul>
1677 <li>
1679 --merge
1680 </p>
1681 </li>
1682 <li>
1684 --strategy
1685 </p>
1686 </li>
1687 <li>
1689 --strategy-option
1690 </p>
1691 </li>
1692 <li>
1694 --autosquash
1695 </p>
1696 </li>
1697 <li>
1699 --rebase-merges
1700 </p>
1701 </li>
1702 <li>
1704 --interactive
1705 </p>
1706 </li>
1707 <li>
1709 --exec
1710 </p>
1711 </li>
1712 <li>
1714 --no-keep-empty
1715 </p>
1716 </li>
1717 <li>
1719 --empty=
1720 </p>
1721 </li>
1722 <li>
1724 --[no-]reapply-cherry-picks when used without --keep-base
1725 </p>
1726 </li>
1727 <li>
1729 --update-refs
1730 </p>
1731 </li>
1732 <li>
1734 --root when used without --onto
1735 </p>
1736 </li>
1737 </ul></div>
1738 <div class="paragraph"><p>In addition, the following pairs of options are incompatible:</p></div>
1739 <div class="ulist"><ul>
1740 <li>
1742 --keep-base and --onto
1743 </p>
1744 </li>
1745 <li>
1747 --keep-base and --root
1748 </p>
1749 </li>
1750 <li>
1752 --fork-point and --root
1753 </p>
1754 </li>
1755 </ul></div>
1756 </div>
1757 </div>
1758 <div class="sect1">
1759 <h2 id="_behavioral_differences">BEHAVIORAL DIFFERENCES</h2>
1760 <div class="sectionbody">
1761 <div class="paragraph"><p><code>git rebase</code> has two primary backends: <em>apply</em> and <em>merge</em>. (The <em>apply</em>
1762 backend used to be known as the <em>am</em> backend, but the name led to
1763 confusion as it looks like a verb instead of a noun. Also, the <em>merge</em>
1764 backend used to be known as the interactive backend, but it is now
1765 used for non-interactive cases as well. Both were renamed based on
1766 lower-level functionality that underpinned each.) There are some
1767 subtle differences in how these two backends behave:</p></div>
1768 <div class="sect2">
1769 <h3 id="_empty_commits">Empty commits</h3>
1770 <div class="paragraph"><p>The <em>apply</em> backend unfortunately drops intentionally empty commits, i.e.
1771 commits that started empty, though these are rare in practice. It
1772 also drops commits that become empty and has no option for controlling
1773 this behavior.</p></div>
1774 <div class="paragraph"><p>The <em>merge</em> backend keeps intentionally empty commits by default (though
1775 with <code>-i</code> they are marked as empty in the todo list editor, or they can
1776 be dropped automatically with <code>--no-keep-empty</code>).</p></div>
1777 <div class="paragraph"><p>Similar to the apply backend, by default the merge backend drops
1778 commits that become empty unless <code>-i</code>/<code>--interactive</code> is specified (in
1779 which case it stops and asks the user what to do). The merge backend
1780 also has an <code>--empty=(drop|keep|stop)</code> option for changing the behavior
1781 of handling commits that become empty.</p></div>
1782 </div>
1783 <div class="sect2">
1784 <h3 id="_directory_rename_detection">Directory rename detection</h3>
1785 <div class="paragraph"><p>Due to the lack of accurate tree information (arising from
1786 constructing fake ancestors with the limited information available in
1787 patches), directory rename detection is disabled in the <em>apply</em> backend.
1788 Disabled directory rename detection means that if one side of history
1789 renames a directory and the other adds new files to the old directory,
1790 then the new files will be left behind in the old directory without
1791 any warning at the time of rebasing that you may want to move these
1792 files into the new directory.</p></div>
1793 <div class="paragraph"><p>Directory rename detection works with the <em>merge</em> backend to provide you
1794 warnings in such cases.</p></div>
1795 </div>
1796 <div class="sect2">
1797 <h3 id="_context">Context</h3>
1798 <div class="paragraph"><p>The <em>apply</em> backend works by creating a sequence of patches (by calling
1799 <code>format-patch</code> internally), and then applying the patches in sequence
1800 (calling <code>am</code> internally). Patches are composed of multiple hunks,
1801 each with line numbers, a context region, and the actual changes. The
1802 line numbers have to be taken with some fuzz, since the other side
1803 will likely have inserted or deleted lines earlier in the file. The
1804 context region is meant to help find how to adjust the line numbers in
1805 order to apply the changes to the right lines. However, if multiple
1806 areas of the code have the same surrounding lines of context, the
1807 wrong one can be picked. There are real-world cases where this has
1808 caused commits to be reapplied incorrectly with no conflicts reported.
1809 Setting <code>diff.context</code> to a larger value may prevent such types of
1810 problems, but increases the chance of spurious conflicts (since it
1811 will require more lines of matching context to apply).</p></div>
1812 <div class="paragraph"><p>The <em>merge</em> backend works with a full copy of each relevant file,
1813 insulating it from these types of problems.</p></div>
1814 </div>
1815 <div class="sect2">
1816 <h3 id="_labelling_of_conflicts_markers">Labelling of conflicts markers</h3>
1817 <div class="paragraph"><p>When there are content conflicts, the merge machinery tries to
1818 annotate each side&#8217;s conflict markers with the commits where the
1819 content came from. Since the <em>apply</em> backend drops the original
1820 information about the rebased commits and their parents (and instead
1821 generates new fake commits based off limited information in the
1822 generated patches), those commits cannot be identified; instead it has
1823 to fall back to a commit summary. Also, when <code>merge.conflictStyle</code> is
1824 set to <code>diff3</code> or <code>zdiff3</code>, the <em>apply</em> backend will use "constructed merge
1825 base" to label the content from the merge base, and thus provide no
1826 information about the merge base commit whatsoever.</p></div>
1827 <div class="paragraph"><p>The <em>merge</em> backend works with the full commits on both sides of history
1828 and thus has no such limitations.</p></div>
1829 </div>
1830 <div class="sect2">
1831 <h3 id="_hooks">Hooks</h3>
1832 <div class="paragraph"><p>The <em>apply</em> backend has not traditionally called the post-commit hook,
1833 while the <em>merge</em> backend has. Both have called the post-checkout hook,
1834 though the <em>merge</em> backend has squelched its output. Further, both
1835 backends only call the post-checkout hook with the starting point
1836 commit of the rebase, not the intermediate commits nor the final
1837 commit. In each case, the calling of these hooks was by accident of
1838 implementation rather than by design (both backends were originally
1839 implemented as shell scripts and happened to invoke other commands
1840 like <code>git checkout</code> or <code>git commit</code> that would call the hooks). Both
1841 backends should have the same behavior, though it is not entirely
1842 clear which, if any, is correct. We will likely make rebase stop
1843 calling either of these hooks in the future.</p></div>
1844 </div>
1845 <div class="sect2">
1846 <h3 id="_interruptability">Interruptability</h3>
1847 <div class="paragraph"><p>The <em>apply</em> backend has safety problems with an ill-timed interrupt; if
1848 the user presses Ctrl-C at the wrong time to try to abort the rebase,
1849 the rebase can enter a state where it cannot be aborted with a
1850 subsequent <code>git rebase --abort</code>. The <em>merge</em> backend does not appear to
1851 suffer from the same shortcoming. (See
1852 <a href="https://lore.kernel.org/git/20200207132152.GC2868@szeder.dev/">https://lore.kernel.org/git/20200207132152.GC2868@szeder.dev/</a> for
1853 details.)</p></div>
1854 </div>
1855 <div class="sect2">
1856 <h3 id="_commit_rewording">Commit Rewording</h3>
1857 <div class="paragraph"><p>When a conflict occurs while rebasing, rebase stops and asks the user
1858 to resolve. Since the user may need to make notable changes while
1859 resolving conflicts, after conflicts are resolved and the user has run
1860 <code>git rebase --continue</code>, the rebase should open an editor and ask the
1861 user to update the commit message. The <em>merge</em> backend does this, while
1862 the <em>apply</em> backend blindly applies the original commit message.</p></div>
1863 </div>
1864 <div class="sect2">
1865 <h3 id="_miscellaneous_differences">Miscellaneous differences</h3>
1866 <div class="paragraph"><p>There are a few more behavioral differences that most folks would
1867 probably consider inconsequential but which are mentioned for
1868 completeness:</p></div>
1869 <div class="ulist"><ul>
1870 <li>
1872 Reflog: The two backends will use different wording when describing
1873 the changes made in the reflog, though both will make use of the
1874 word "rebase".
1875 </p>
1876 </li>
1877 <li>
1879 Progress, informational, and error messages: The two backends
1880 provide slightly different progress and informational messages.
1881 Also, the apply backend writes error messages (such as "Your files
1882 would be overwritten&#8230;") to stdout, while the merge backend writes
1883 them to stderr.
1884 </p>
1885 </li>
1886 <li>
1888 State directories: The two backends keep their state in different
1889 directories under <code>.git/</code>
1890 </p>
1891 </li>
1892 </ul></div>
1893 </div>
1894 </div>
1895 </div>
1896 <div class="sect1">
1897 <h2 id="_merge_strategies">MERGE STRATEGIES</h2>
1898 <div class="sectionbody">
1899 <div class="paragraph"><p>The merge mechanism (<code>git merge</code> and <code>git pull</code> commands) allows the
1900 backend <em>merge strategies</em> to be chosen with <code>-s</code> option. Some strategies
1901 can also take their own options, which can be passed by giving <code>-X&lt;option&gt;</code>
1902 arguments to <code>git merge</code> and/or <code>git pull</code>.</p></div>
1903 <div class="dlist"><dl>
1904 <dt class="hdlist1">
1906 </dt>
1907 <dd>
1909 This is the default merge strategy when pulling or merging one
1910 branch. This strategy can only resolve two heads using a
1911 3-way merge algorithm. When there is more than one common
1912 ancestor that can be used for 3-way merge, it creates a merged
1913 tree of the common ancestors and uses that as the reference
1914 tree for the 3-way merge. This has been reported to result in
1915 fewer merge conflicts without causing mismerges by tests done
1916 on actual merge commits taken from Linux 2.6 kernel
1917 development history. Additionally this strategy can detect
1918 and handle merges involving renames. It does not make use of
1919 detected copies. The name for this algorithm is an acronym
1920 ("Ostensibly Recursive&#8217;s Twin") and came from the fact that it
1921 was written as a replacement for the previous default
1922 algorithm, <code>recursive</code>.
1923 </p>
1924 <div class="paragraph"><p>The <em>ort</em> strategy can take the following options:</p></div>
1925 <div class="dlist"><dl>
1926 <dt class="hdlist1">
1927 ours
1928 </dt>
1929 <dd>
1931 This option forces conflicting hunks to be auto-resolved cleanly by
1932 favoring <em>our</em> version. Changes from the other tree that do not
1933 conflict with our side are reflected in the merge result.
1934 For a binary file, the entire contents are taken from our side.
1935 </p>
1936 <div class="paragraph"><p>This should not be confused with the <em>ours</em> merge strategy, which does not
1937 even look at what the other tree contains at all. It discards everything
1938 the other tree did, declaring <em>our</em> history contains all that happened in it.</p></div>
1939 </dd>
1940 <dt class="hdlist1">
1941 theirs
1942 </dt>
1943 <dd>
1945 This is the opposite of <em>ours</em>; note that, unlike <em>ours</em>, there is
1946 no <em>theirs</em> merge strategy to confuse this merge option with.
1947 </p>
1948 </dd>
1949 <dt class="hdlist1">
1950 ignore-space-change
1951 </dt>
1952 <dt class="hdlist1">
1953 ignore-all-space
1954 </dt>
1955 <dt class="hdlist1">
1956 ignore-space-at-eol
1957 </dt>
1958 <dt class="hdlist1">
1959 ignore-cr-at-eol
1960 </dt>
1961 <dd>
1963 Treats lines with the indicated type of whitespace change as
1964 unchanged for the sake of a three-way merge. Whitespace
1965 changes mixed with other changes to a line are not ignored.
1966 See also <a href="git-diff.html">git-diff(1)</a> <code>-b</code>, <code>-w</code>,
1967 <code>--ignore-space-at-eol</code>, and <code>--ignore-cr-at-eol</code>.
1968 </p>
1969 <div class="ulist"><ul>
1970 <li>
1972 If <em>their</em> version only introduces whitespace changes to a line,
1973 <em>our</em> version is used;
1974 </p>
1975 </li>
1976 <li>
1978 If <em>our</em> version introduces whitespace changes but <em>their</em>
1979 version includes a substantial change, <em>their</em> version is used;
1980 </p>
1981 </li>
1982 <li>
1984 Otherwise, the merge proceeds in the usual way.
1985 </p>
1986 </li>
1987 </ul></div>
1988 </dd>
1989 <dt class="hdlist1">
1990 renormalize
1991 </dt>
1992 <dd>
1994 This runs a virtual check-out and check-in of all three stages
1995 of a file when resolving a three-way merge. This option is
1996 meant to be used when merging branches with different clean
1997 filters or end-of-line normalization rules. See "Merging
1998 branches with differing checkin/checkout attributes" in
1999 <a href="gitattributes.html">gitattributes(5)</a> for details.
2000 </p>
2001 </dd>
2002 <dt class="hdlist1">
2003 no-renormalize
2004 </dt>
2005 <dd>
2007 Disables the <code>renormalize</code> option. This overrides the
2008 <code>merge.renormalize</code> configuration variable.
2009 </p>
2010 </dd>
2011 <dt class="hdlist1">
2012 find-renames[=&lt;n&gt;]
2013 </dt>
2014 <dd>
2016 Turn on rename detection, optionally setting the similarity
2017 threshold. This is the default. This overrides the
2018 <em>merge.renames</em> configuration variable.
2019 See also <a href="git-diff.html">git-diff(1)</a> <code>--find-renames</code>.
2020 </p>
2021 </dd>
2022 <dt class="hdlist1">
2023 rename-threshold=&lt;n&gt;
2024 </dt>
2025 <dd>
2027 Deprecated synonym for <code>find-renames=&lt;n&gt;</code>.
2028 </p>
2029 </dd>
2030 <dt class="hdlist1">
2031 subtree[=&lt;path&gt;]
2032 </dt>
2033 <dd>
2035 This option is a more advanced form of <em>subtree</em> strategy, where
2036 the strategy makes a guess on how two trees must be shifted to
2037 match with each other when merging. Instead, the specified path
2038 is prefixed (or stripped from the beginning) to make the shape of
2039 two trees to match.
2040 </p>
2041 </dd>
2042 </dl></div>
2043 </dd>
2044 <dt class="hdlist1">
2045 recursive
2046 </dt>
2047 <dd>
2049 This can only resolve two heads using a 3-way merge
2050 algorithm. When there is more than one common
2051 ancestor that can be used for 3-way merge, it creates a
2052 merged tree of the common ancestors and uses that as
2053 the reference tree for the 3-way merge. This has been
2054 reported to result in fewer merge conflicts without
2055 causing mismerges by tests done on actual merge commits
2056 taken from Linux 2.6 kernel development history.
2057 Additionally this can detect and handle merges involving
2058 renames. It does not make use of detected copies. This was
2059 the default strategy for resolving two heads from Git v0.99.9k
2060 until v2.33.0.
2061 </p>
2062 <div class="paragraph"><p>The <em>recursive</em> strategy takes the same options as <em>ort</em>. However,
2063 there are three additional options that <em>ort</em> ignores (not documented
2064 above) that are potentially useful with the <em>recursive</em> strategy:</p></div>
2065 <div class="dlist"><dl>
2066 <dt class="hdlist1">
2067 patience
2068 </dt>
2069 <dd>
2071 Deprecated synonym for <code>diff-algorithm=patience</code>.
2072 </p>
2073 </dd>
2074 <dt class="hdlist1">
2075 diff-algorithm=[patience|minimal|histogram|myers]
2076 </dt>
2077 <dd>
2079 Use a different diff algorithm while merging, which can help
2080 avoid mismerges that occur due to unimportant matching lines
2081 (such as braces from distinct functions). See also
2082 <a href="git-diff.html">git-diff(1)</a> <code>--diff-algorithm</code>. Note that <code>ort</code>
2083 specifically uses <code>diff-algorithm=histogram</code>, while <code>recursive</code>
2084 defaults to the <code>diff.algorithm</code> config setting.
2085 </p>
2086 </dd>
2087 <dt class="hdlist1">
2088 no-renames
2089 </dt>
2090 <dd>
2092 Turn off rename detection. This overrides the <code>merge.renames</code>
2093 configuration variable.
2094 See also <a href="git-diff.html">git-diff(1)</a> <code>--no-renames</code>.
2095 </p>
2096 </dd>
2097 </dl></div>
2098 </dd>
2099 <dt class="hdlist1">
2100 resolve
2101 </dt>
2102 <dd>
2104 This can only resolve two heads (i.e. the current branch
2105 and another branch you pulled from) using a 3-way merge
2106 algorithm. It tries to carefully detect criss-cross
2107 merge ambiguities. It does not handle renames.
2108 </p>
2109 </dd>
2110 <dt class="hdlist1">
2111 octopus
2112 </dt>
2113 <dd>
2115 This resolves cases with more than two heads, but refuses to do
2116 a complex merge that needs manual resolution. It is
2117 primarily meant to be used for bundling topic branch
2118 heads together. This is the default merge strategy when
2119 pulling or merging more than one branch.
2120 </p>
2121 </dd>
2122 <dt class="hdlist1">
2123 ours
2124 </dt>
2125 <dd>
2127 This resolves any number of heads, but the resulting tree of the
2128 merge is always that of the current branch head, effectively
2129 ignoring all changes from all other branches. It is meant to
2130 be used to supersede old development history of side
2131 branches. Note that this is different from the -Xours option to
2132 the <em>recursive</em> merge strategy.
2133 </p>
2134 </dd>
2135 <dt class="hdlist1">
2136 subtree
2137 </dt>
2138 <dd>
2140 This is a modified <code>ort</code> strategy. When merging trees A and
2141 B, if B corresponds to a subtree of A, B is first adjusted to
2142 match the tree structure of A, instead of reading the trees at
2143 the same level. This adjustment is also done to the common
2144 ancestor tree.
2145 </p>
2146 </dd>
2147 </dl></div>
2148 <div class="paragraph"><p>With the strategies that use 3-way merge (including the default, <em>ort</em>),
2149 if a change is made on both branches, but later reverted on one of the
2150 branches, that change will be present in the merged result; some people find
2151 this behavior confusing. It occurs because only the heads and the merge base
2152 are considered when performing a merge, not the individual commits. The merge
2153 algorithm therefore considers the reverted change as no change at all, and
2154 substitutes the changed version instead.</p></div>
2155 </div>
2156 </div>
2157 <div class="sect1">
2158 <h2 id="_notes">NOTES</h2>
2159 <div class="sectionbody">
2160 <div class="paragraph"><p>You should understand the implications of using <code>git rebase</code> on a
2161 repository that you share. See also RECOVERING FROM UPSTREAM REBASE
2162 below.</p></div>
2163 <div class="paragraph"><p>When the rebase is run, it will first execute a <code>pre-rebase</code> hook if one
2164 exists. You can use this hook to do sanity checks and reject the rebase
2165 if it isn&#8217;t appropriate. Please see the template <code>pre-rebase</code> hook script
2166 for an example.</p></div>
2167 <div class="paragraph"><p>Upon completion, <code>&lt;branch&gt;</code> will be the current branch.</p></div>
2168 </div>
2169 </div>
2170 <div class="sect1">
2171 <h2 id="_interactive_mode">INTERACTIVE MODE</h2>
2172 <div class="sectionbody">
2173 <div class="paragraph"><p>Rebasing interactively means that you have a chance to edit the commits
2174 which are rebased. You can reorder the commits, and you can
2175 remove them (weeding out bad or otherwise unwanted patches).</p></div>
2176 <div class="paragraph"><p>The interactive mode is meant for this type of workflow:</p></div>
2177 <div class="olist arabic"><ol class="arabic">
2178 <li>
2180 have a wonderful idea
2181 </p>
2182 </li>
2183 <li>
2185 hack on the code
2186 </p>
2187 </li>
2188 <li>
2190 prepare a series for submission
2191 </p>
2192 </li>
2193 <li>
2195 submit
2196 </p>
2197 </li>
2198 </ol></div>
2199 <div class="paragraph"><p>where point 2. consists of several instances of</p></div>
2200 <div class="paragraph"><p>a) regular use</p></div>
2201 <div class="olist arabic"><ol class="arabic">
2202 <li>
2204 finish something worthy of a commit
2205 </p>
2206 </li>
2207 <li>
2209 commit
2210 </p>
2211 </li>
2212 </ol></div>
2213 <div class="paragraph"><p>b) independent fixup</p></div>
2214 <div class="olist arabic"><ol class="arabic">
2215 <li>
2217 realize that something does not work
2218 </p>
2219 </li>
2220 <li>
2222 fix that
2223 </p>
2224 </li>
2225 <li>
2227 commit it
2228 </p>
2229 </li>
2230 </ol></div>
2231 <div class="paragraph"><p>Sometimes the thing fixed in b.2. cannot be amended to the not-quite
2232 perfect commit it fixes, because that commit is buried deeply in a
2233 patch series. That is exactly what interactive rebase is for: use it
2234 after plenty of "a"s and "b"s, by rearranging and editing
2235 commits, and squashing multiple commits into one.</p></div>
2236 <div class="paragraph"><p>Start it with the last commit you want to retain as-is:</p></div>
2237 <div class="literalblock">
2238 <div class="content">
2239 <pre><code>git rebase -i &lt;after-this-commit&gt;</code></pre>
2240 </div></div>
2241 <div class="paragraph"><p>An editor will be fired up with all the commits in your current branch
2242 (ignoring merge commits), which come after the given commit. You can
2243 reorder the commits in this list to your heart&#8217;s content, and you can
2244 remove them. The list looks more or less like this:</p></div>
2245 <div class="listingblock">
2246 <div class="content">
2247 <pre><code>pick deadbee The oneline of this commit
2248 pick fa1afe1 The oneline of the next commit
2249 ...</code></pre>
2250 </div></div>
2251 <div class="paragraph"><p>The oneline descriptions are purely for your pleasure; <em>git rebase</em> will
2252 not look at them but at the commit names ("deadbee" and "fa1afe1" in this
2253 example), so do not delete or edit the names.</p></div>
2254 <div class="paragraph"><p>By replacing the command "pick" with the command "edit", you can tell
2255 <code>git rebase</code> to stop after applying that commit, so that you can edit
2256 the files and/or the commit message, amend the commit, and continue
2257 rebasing.</p></div>
2258 <div class="paragraph"><p>To interrupt the rebase (just like an "edit" command would do, but without
2259 cherry-picking any commit first), use the "break" command.</p></div>
2260 <div class="paragraph"><p>If you just want to edit the commit message for a commit, replace the
2261 command "pick" with the command "reword".</p></div>
2262 <div class="paragraph"><p>To drop a commit, replace the command "pick" with "drop", or just
2263 delete the matching line.</p></div>
2264 <div class="paragraph"><p>If you want to fold two or more commits into one, replace the command
2265 "pick" for the second and subsequent commits with "squash" or "fixup".
2266 If the commits had different authors, the folded commit will be
2267 attributed to the author of the first commit. The suggested commit
2268 message for the folded commit is the concatenation of the first
2269 commit&#8217;s message with those identified by "squash" commands, omitting the
2270 messages of commits identified by "fixup" commands, unless "fixup -c"
2271 is used. In that case the suggested commit message is only the message
2272 of the "fixup -c" commit, and an editor is opened allowing you to edit
2273 the message. The contents (patch) of the "fixup -c" commit are still
2274 incorporated into the folded commit. If there is more than one "fixup -c"
2275 commit, the message from the final one is used. You can also use
2276 "fixup -C" to get the same behavior as "fixup -c" except without opening
2277 an editor.</p></div>
2278 <div class="paragraph"><p><code>git rebase</code> will stop when "pick" has been replaced with "edit" or
2279 when a command fails due to merge errors. When you are done editing
2280 and/or resolving conflicts you can continue with <code>git rebase --continue</code>.</p></div>
2281 <div class="paragraph"><p>For example, if you want to reorder the last 5 commits, such that what
2282 was <code>HEAD~4</code> becomes the new <code>HEAD</code>. To achieve that, you would call
2283 <code>git rebase</code> like this:</p></div>
2284 <div class="listingblock">
2285 <div class="content">
2286 <pre><code>$ git rebase -i HEAD~5</code></pre>
2287 </div></div>
2288 <div class="paragraph"><p>And move the first patch to the end of the list.</p></div>
2289 <div class="paragraph"><p>You might want to recreate merge commits, e.g. if you have a history
2290 like this:</p></div>
2291 <div class="listingblock">
2292 <div class="content">
2293 <pre><code> X
2295 A---M---B
2297 ---o---O---P---Q</code></pre>
2298 </div></div>
2299 <div class="paragraph"><p>Suppose you want to rebase the side branch starting at "A" to "Q". Make
2300 sure that the current <code>HEAD</code> is "B", and call</p></div>
2301 <div class="listingblock">
2302 <div class="content">
2303 <pre><code>$ git rebase -i -r --onto Q O</code></pre>
2304 </div></div>
2305 <div class="paragraph"><p>Reordering and editing commits usually creates untested intermediate
2306 steps. You may want to check that your history editing did not break
2307 anything by running a test, or at least recompiling at intermediate
2308 points in history by using the "exec" command (shortcut "x"). You may
2309 do so by creating a todo list like this one:</p></div>
2310 <div class="listingblock">
2311 <div class="content">
2312 <pre><code>pick deadbee Implement feature XXX
2313 fixup f1a5c00 Fix to feature XXX
2314 exec make
2315 pick c0ffeee The oneline of the next commit
2316 edit deadbab The oneline of the commit after
2317 exec cd subdir; make test
2318 ...</code></pre>
2319 </div></div>
2320 <div class="paragraph"><p>The interactive rebase will stop when a command fails (i.e. exits with
2321 non-0 status) to give you an opportunity to fix the problem. You can
2322 continue with <code>git rebase --continue</code>.</p></div>
2323 <div class="paragraph"><p>The "exec" command launches the command in a shell (the default one, usually
2324 /bin/sh), so you can use shell features (like "cd", "&gt;", ";" &#8230;). The command
2325 is run from the root of the working tree.</p></div>
2326 <div class="listingblock">
2327 <div class="content">
2328 <pre><code>$ git rebase -i --exec "make test"</code></pre>
2329 </div></div>
2330 <div class="paragraph"><p>This command lets you check that intermediate commits are compilable.
2331 The todo list becomes like that:</p></div>
2332 <div class="listingblock">
2333 <div class="content">
2334 <pre><code>pick 5928aea one
2335 exec make test
2336 pick 04d0fda two
2337 exec make test
2338 pick ba46169 three
2339 exec make test
2340 pick f4593f9 four
2341 exec make test</code></pre>
2342 </div></div>
2343 </div>
2344 </div>
2345 <div class="sect1">
2346 <h2 id="_splitting_commits">SPLITTING COMMITS</h2>
2347 <div class="sectionbody">
2348 <div class="paragraph"><p>In interactive mode, you can mark commits with the action "edit". However,
2349 this does not necessarily mean that <code>git rebase</code> expects the result of this
2350 edit to be exactly one commit. Indeed, you can undo the commit, or you can
2351 add other commits. This can be used to split a commit into two:</p></div>
2352 <div class="ulist"><ul>
2353 <li>
2355 Start an interactive rebase with <code>git rebase -i &lt;commit&gt;^</code>, where
2356 <code>&lt;commit&gt;</code> is the commit you want to split. In fact, any commit range
2357 will do, as long as it contains that commit.
2358 </p>
2359 </li>
2360 <li>
2362 Mark the commit you want to split with the action "edit".
2363 </p>
2364 </li>
2365 <li>
2367 When it comes to editing that commit, execute <code>git reset HEAD^</code>. The
2368 effect is that the <code>HEAD</code> is rewound by one, and the index follows suit.
2369 However, the working tree stays the same.
2370 </p>
2371 </li>
2372 <li>
2374 Now add the changes to the index that you want to have in the first
2375 commit. You can use <code>git add</code> (possibly interactively) or
2376 <code>git gui</code> (or both) to do that.
2377 </p>
2378 </li>
2379 <li>
2381 Commit the now-current index with whatever commit message is appropriate
2382 now.
2383 </p>
2384 </li>
2385 <li>
2387 Repeat the last two steps until your working tree is clean.
2388 </p>
2389 </li>
2390 <li>
2392 Continue the rebase with <code>git rebase --continue</code>.
2393 </p>
2394 </li>
2395 </ul></div>
2396 <div class="paragraph"><p>If you are not absolutely sure that the intermediate revisions are
2397 consistent (they compile, pass the testsuite, etc.) you should use
2398 <code>git stash</code> to stash away the not-yet-committed changes
2399 after each commit, test, and amend the commit if fixes are necessary.</p></div>
2400 </div>
2401 </div>
2402 <div class="sect1">
2403 <h2 id="_recovering_from_upstream_rebase">RECOVERING FROM UPSTREAM REBASE</h2>
2404 <div class="sectionbody">
2405 <div class="paragraph"><p>Rebasing (or any other form of rewriting) a branch that others have
2406 based work on is a bad idea: anyone downstream of it is forced to
2407 manually fix their history. This section explains how to do the fix
2408 from the downstream&#8217;s point of view. The real fix, however, would be
2409 to avoid rebasing the upstream in the first place.</p></div>
2410 <div class="paragraph"><p>To illustrate, suppose you are in a situation where someone develops a
2411 <em>subsystem</em> branch, and you are working on a <em>topic</em> that is dependent
2412 on this <em>subsystem</em>. You might end up with a history like the
2413 following:</p></div>
2414 <div class="listingblock">
2415 <div class="content">
2416 <pre><code> o---o---o---o---o---o---o---o master
2418 o---o---o---o---o subsystem
2420 *---*---* topic</code></pre>
2421 </div></div>
2422 <div class="paragraph"><p>If <em>subsystem</em> is rebased against <em>master</em>, the following happens:</p></div>
2423 <div class="listingblock">
2424 <div class="content">
2425 <pre><code> o---o---o---o---o---o---o---o master
2427 o---o---o---o---o o'--o'--o'--o'--o' subsystem
2429 *---*---* topic</code></pre>
2430 </div></div>
2431 <div class="paragraph"><p>If you now continue development as usual, and eventually merge <em>topic</em>
2432 to <em>subsystem</em>, the commits from <em>subsystem</em> will remain duplicated forever:</p></div>
2433 <div class="listingblock">
2434 <div class="content">
2435 <pre><code> o---o---o---o---o---o---o---o master
2437 o---o---o---o---o o'--o'--o'--o'--o'--M subsystem
2439 *---*---*-..........-*--* topic</code></pre>
2440 </div></div>
2441 <div class="paragraph"><p>Such duplicates are generally frowned upon because they clutter up
2442 history, making it harder to follow. To clean things up, you need to
2443 transplant the commits on <em>topic</em> to the new <em>subsystem</em> tip, i.e.,
2444 rebase <em>topic</em>. This becomes a ripple effect: anyone downstream from
2445 <em>topic</em> is forced to rebase too, and so on!</p></div>
2446 <div class="paragraph"><p>There are two kinds of fixes, discussed in the following subsections:</p></div>
2447 <div class="dlist"><dl>
2448 <dt class="hdlist1">
2449 Easy case: The changes are literally the same.
2450 </dt>
2451 <dd>
2453 This happens if the <em>subsystem</em> rebase was a simple rebase and
2454 had no conflicts.
2455 </p>
2456 </dd>
2457 <dt class="hdlist1">
2458 Hard case: The changes are not the same.
2459 </dt>
2460 <dd>
2462 This happens if the <em>subsystem</em> rebase had conflicts, or used
2463 <code>--interactive</code> to omit, edit, squash, or fixup commits; or
2464 if the upstream used one of <code>commit --amend</code>, <code>reset</code>, or
2465 a full history rewriting command like
2466 <a href="https://github.com/newren/git-filter-repo"><code>filter-repo</code></a>.
2467 </p>
2468 </dd>
2469 </dl></div>
2470 <div class="sect2">
2471 <h3 id="_the_easy_case">The easy case</h3>
2472 <div class="paragraph"><p>Only works if the changes (patch IDs based on the diff contents) on
2473 <em>subsystem</em> are literally the same before and after the rebase
2474 <em>subsystem</em> did.</p></div>
2475 <div class="paragraph"><p>In that case, the fix is easy because <em>git rebase</em> knows to skip
2476 changes that are already present in the new upstream (unless
2477 <code>--reapply-cherry-picks</code> is given). So if you say
2478 (assuming you&#8217;re on <em>topic</em>)</p></div>
2479 <div class="listingblock">
2480 <div class="content">
2481 <pre><code> $ git rebase subsystem</code></pre>
2482 </div></div>
2483 <div class="paragraph"><p>you will end up with the fixed history</p></div>
2484 <div class="listingblock">
2485 <div class="content">
2486 <pre><code> o---o---o---o---o---o---o---o master
2488 o'--o'--o'--o'--o' subsystem
2490 *---*---* topic</code></pre>
2491 </div></div>
2492 </div>
2493 <div class="sect2">
2494 <h3 id="_the_hard_case">The hard case</h3>
2495 <div class="paragraph"><p>Things get more complicated if the <em>subsystem</em> changes do not exactly
2496 correspond to the ones before the rebase.</p></div>
2497 <div class="admonitionblock">
2498 <table><tr>
2499 <td class="icon">
2500 <div class="title">Note</div>
2501 </td>
2502 <td class="content">While an "easy case recovery" sometimes appears to be successful
2503 even in the hard case, it may have unintended consequences. For
2504 example, a commit that was removed via <code>git rebase
2505 --interactive</code> will be <strong>resurrected</strong>!</td>
2506 </tr></table>
2507 </div>
2508 <div class="paragraph"><p>The idea is to manually tell <code>git rebase</code> "where the old <em>subsystem</em>
2509 ended and your <em>topic</em> began", that is, what the old merge base
2510 between them was. You will have to find a way to name the last commit
2511 of the old <em>subsystem</em>, for example:</p></div>
2512 <div class="ulist"><ul>
2513 <li>
2515 With the <em>subsystem</em> reflog: after <code>git fetch</code>, the old tip of
2516 <em>subsystem</em> is at <code>subsystem@{1}</code>. Subsequent fetches will
2517 increase the number. (See <a href="git-reflog.html">git-reflog(1)</a>.)
2518 </p>
2519 </li>
2520 <li>
2522 Relative to the tip of <em>topic</em>: knowing that your <em>topic</em> has three
2523 commits, the old tip of <em>subsystem</em> must be <code>topic~3</code>.
2524 </p>
2525 </li>
2526 </ul></div>
2527 <div class="paragraph"><p>You can then transplant the old <code>subsystem..topic</code> to the new tip by
2528 saying (for the reflog case, and assuming you are on <em>topic</em> already):</p></div>
2529 <div class="listingblock">
2530 <div class="content">
2531 <pre><code> $ git rebase --onto subsystem subsystem@{1}</code></pre>
2532 </div></div>
2533 <div class="paragraph"><p>The ripple effect of a "hard case" recovery is especially bad:
2534 <em>everyone</em> downstream from <em>topic</em> will now have to perform a "hard
2535 case" recovery too!</p></div>
2536 </div>
2537 </div>
2538 </div>
2539 <div class="sect1">
2540 <h2 id="_rebasing_merges">REBASING MERGES</h2>
2541 <div class="sectionbody">
2542 <div class="paragraph"><p>The interactive rebase command was originally designed to handle
2543 individual patch series. As such, it makes sense to exclude merge
2544 commits from the todo list, as the developer may have merged the
2545 then-current <code>master</code> while working on the branch, only to rebase
2546 all the commits onto <code>master</code> eventually (skipping the merge
2547 commits).</p></div>
2548 <div class="paragraph"><p>However, there are legitimate reasons why a developer may want to
2549 recreate merge commits: to keep the branch structure (or "commit
2550 topology") when working on multiple, inter-related branches.</p></div>
2551 <div class="paragraph"><p>In the following example, the developer works on a topic branch that
2552 refactors the way buttons are defined, and on another topic branch
2553 that uses that refactoring to implement a "Report a bug" button. The
2554 output of <code>git log --graph --format=%s -5</code> may look like this:</p></div>
2555 <div class="listingblock">
2556 <div class="content">
2557 <pre><code>* Merge branch 'report-a-bug'
2559 | * Add the feedback button
2560 * | Merge branch 'refactor-button'
2561 |\ \
2562 | |/
2563 | * Use the Button class for all buttons
2564 | * Extract a generic Button class from the DownloadButton one</code></pre>
2565 </div></div>
2566 <div class="paragraph"><p>The developer might want to rebase those commits to a newer <code>master</code>
2567 while keeping the branch topology, for example when the first topic
2568 branch is expected to be integrated into <code>master</code> much earlier than the
2569 second one, say, to resolve merge conflicts with changes to the
2570 DownloadButton class that made it into <code>master</code>.</p></div>
2571 <div class="paragraph"><p>This rebase can be performed using the <code>--rebase-merges</code> option.
2572 It will generate a todo list looking like this:</p></div>
2573 <div class="listingblock">
2574 <div class="content">
2575 <pre><code>label onto
2577 # Branch: refactor-button
2578 reset onto
2579 pick 123456 Extract a generic Button class from the DownloadButton one
2580 pick 654321 Use the Button class for all buttons
2581 label refactor-button
2583 # Branch: report-a-bug
2584 reset refactor-button # Use the Button class for all buttons
2585 pick abcdef Add the feedback button
2586 label report-a-bug
2588 reset onto
2589 merge -C a1b2c3 refactor-button # Merge 'refactor-button'
2590 merge -C 6f5e4d report-a-bug # Merge 'report-a-bug'</code></pre>
2591 </div></div>
2592 <div class="paragraph"><p>In contrast to a regular interactive rebase, there are <code>label</code>, <code>reset</code>
2593 and <code>merge</code> commands in addition to <code>pick</code> ones.</p></div>
2594 <div class="paragraph"><p>The <code>label</code> command associates a label with the current HEAD when that
2595 command is executed. These labels are created as worktree-local refs
2596 (<code>refs/rewritten/&lt;label&gt;</code>) that will be deleted when the rebase
2597 finishes. That way, rebase operations in multiple worktrees linked to
2598 the same repository do not interfere with one another. If the <code>label</code>
2599 command fails, it is rescheduled immediately, with a helpful message how
2600 to proceed.</p></div>
2601 <div class="paragraph"><p>The <code>reset</code> command resets the HEAD, index and worktree to the specified
2602 revision. It is similar to an <code>exec git reset --hard &lt;label&gt;</code>, but
2603 refuses to overwrite untracked files. If the <code>reset</code> command fails, it is
2604 rescheduled immediately, with a helpful message how to edit the todo list
2605 (this typically happens when a <code>reset</code> command was inserted into the todo
2606 list manually and contains a typo).</p></div>
2607 <div class="paragraph"><p>The <code>merge</code> command will merge the specified revision(s) into whatever
2608 is HEAD at that time. With <code>-C &lt;original-commit&gt;</code>, the commit message of
2609 the specified merge commit will be used. When the <code>-C</code> is changed to
2610 a lower-case <code>-c</code>, the message will be opened in an editor after a
2611 successful merge so that the user can edit the message.</p></div>
2612 <div class="paragraph"><p>If a <code>merge</code> command fails for any reason other than merge conflicts (i.e.
2613 when the merge operation did not even start), it is rescheduled immediately.</p></div>
2614 <div class="paragraph"><p>By default, the <code>merge</code> command will use the <code>ort</code> merge strategy for
2615 regular merges, and <code>octopus</code> for octopus merges. One can specify a
2616 default strategy for all merges using the <code>--strategy</code> argument when
2617 invoking rebase, or can override specific merges in the interactive
2618 list of commands by using an <code>exec</code> command to call <code>git merge</code>
2619 explicitly with a <code>--strategy</code> argument. Note that when calling <code>git
2620 merge</code> explicitly like this, you can make use of the fact that the
2621 labels are worktree-local refs (the ref <code>refs/rewritten/onto</code> would
2622 correspond to the label <code>onto</code>, for example) in order to refer to the
2623 branches you want to merge.</p></div>
2624 <div class="paragraph"><p>Note: the first command (<code>label onto</code>) labels the revision onto which
2625 the commits are rebased; The name <code>onto</code> is just a convention, as a nod
2626 to the <code>--onto</code> option.</p></div>
2627 <div class="paragraph"><p>It is also possible to introduce completely new merge commits from scratch
2628 by adding a command of the form <code>merge &lt;merge-head&gt;</code>. This form will
2629 generate a tentative commit message and always open an editor to let the
2630 user edit it. This can be useful e.g. when a topic branch turns out to
2631 address more than a single concern and wants to be split into two or
2632 even more topic branches. Consider this todo list:</p></div>
2633 <div class="listingblock">
2634 <div class="content">
2635 <pre><code>pick 192837 Switch from GNU Makefiles to CMake
2636 pick 5a6c7e Document the switch to CMake
2637 pick 918273 Fix detection of OpenSSL in CMake
2638 pick afbecd http: add support for TLS v1.3
2639 pick fdbaec Fix detection of cURL in CMake on Windows</code></pre>
2640 </div></div>
2641 <div class="paragraph"><p>The one commit in this list that is not related to CMake may very well
2642 have been motivated by working on fixing all those bugs introduced by
2643 switching to CMake, but it addresses a different concern. To split this
2644 branch into two topic branches, the todo list could be edited like this:</p></div>
2645 <div class="listingblock">
2646 <div class="content">
2647 <pre><code>label onto
2649 pick afbecd http: add support for TLS v1.3
2650 label tlsv1.3
2652 reset onto
2653 pick 192837 Switch from GNU Makefiles to CMake
2654 pick 918273 Fix detection of OpenSSL in CMake
2655 pick fdbaec Fix detection of cURL in CMake on Windows
2656 pick 5a6c7e Document the switch to CMake
2657 label cmake
2659 reset onto
2660 merge tlsv1.3
2661 merge cmake</code></pre>
2662 </div></div>
2663 </div>
2664 </div>
2665 <div class="sect1">
2666 <h2 id="_configuration">CONFIGURATION</h2>
2667 <div class="sectionbody">
2668 <div class="paragraph"><p>Everything below this line in this section is selectively included
2669 from the <a href="git-config.html">git-config(1)</a> documentation. The content is the same
2670 as what&#8217;s found there:</p></div>
2671 <div class="dlist"><dl>
2672 <dt class="hdlist1">
2673 rebase.backend
2674 </dt>
2675 <dd>
2677 Default backend to use for rebasing. Possible choices are
2678 <em>apply</em> or <em>merge</em>. In the future, if the merge backend gains
2679 all remaining capabilities of the apply backend, this setting
2680 may become unused.
2681 </p>
2682 </dd>
2683 <dt class="hdlist1">
2684 rebase.stat
2685 </dt>
2686 <dd>
2688 Whether to show a diffstat of what changed upstream since the last
2689 rebase. False by default.
2690 </p>
2691 </dd>
2692 <dt class="hdlist1">
2693 rebase.autoSquash
2694 </dt>
2695 <dd>
2697 If set to true, enable the <code>--autosquash</code> option of
2698 <a href="git-rebase.html">git-rebase(1)</a> by default for interactive mode.
2699 This can be overridden with the <code>--no-autosquash</code> option.
2700 </p>
2701 </dd>
2702 <dt class="hdlist1">
2703 rebase.autoStash
2704 </dt>
2705 <dd>
2707 When set to true, automatically create a temporary stash entry
2708 before the operation begins, and apply it after the operation
2709 ends. This means that you can run rebase on a dirty worktree.
2710 However, use with care: the final stash application after a
2711 successful rebase might result in non-trivial conflicts.
2712 This option can be overridden by the <code>--no-autostash</code> and
2713 <code>--autostash</code> options of <a href="git-rebase.html">git-rebase(1)</a>.
2714 Defaults to false.
2715 </p>
2716 </dd>
2717 <dt class="hdlist1">
2718 rebase.updateRefs
2719 </dt>
2720 <dd>
2722 If set to true enable <code>--update-refs</code> option by default.
2723 </p>
2724 </dd>
2725 <dt class="hdlist1">
2726 rebase.missingCommitsCheck
2727 </dt>
2728 <dd>
2730 If set to "warn", git rebase -i will print a warning if some
2731 commits are removed (e.g. a line was deleted), however the
2732 rebase will still proceed. If set to "error", it will print
2733 the previous warning and stop the rebase, <em>git rebase
2734 --edit-todo</em> can then be used to correct the error. If set to
2735 "ignore", no checking is done.
2736 To drop a commit without warning or error, use the <code>drop</code>
2737 command in the todo list.
2738 Defaults to "ignore".
2739 </p>
2740 </dd>
2741 <dt class="hdlist1">
2742 rebase.instructionFormat
2743 </dt>
2744 <dd>
2746 A format string, as specified in <a href="git-log.html">git-log(1)</a>, to be used for the
2747 todo list during an interactive rebase. The format will
2748 automatically have the commit hash prepended to the format.
2749 </p>
2750 </dd>
2751 <dt class="hdlist1">
2752 rebase.abbreviateCommands
2753 </dt>
2754 <dd>
2756 If set to true, <code>git rebase</code> will use abbreviated command names in the
2757 todo list resulting in something like this:
2758 </p>
2759 <div class="listingblock">
2760 <div class="content">
2761 <pre><code> p deadbee The oneline of the commit
2762 p fa1afe1 The oneline of the next commit
2763 ...</code></pre>
2764 </div></div>
2765 <div class="paragraph"><p>instead of:</p></div>
2766 <div class="listingblock">
2767 <div class="content">
2768 <pre><code> pick deadbee The oneline of the commit
2769 pick fa1afe1 The oneline of the next commit
2770 ...</code></pre>
2771 </div></div>
2772 <div class="paragraph"><p>Defaults to false.</p></div>
2773 </dd>
2774 <dt class="hdlist1">
2775 rebase.rescheduleFailedExec
2776 </dt>
2777 <dd>
2779 Automatically reschedule <code>exec</code> commands that failed. This only makes
2780 sense in interactive mode (or when an <code>--exec</code> option was provided).
2781 This is the same as specifying the <code>--reschedule-failed-exec</code> option.
2782 </p>
2783 </dd>
2784 <dt class="hdlist1">
2785 rebase.forkPoint
2786 </dt>
2787 <dd>
2789 If set to false set <code>--no-fork-point</code> option by default.
2790 </p>
2791 </dd>
2792 <dt class="hdlist1">
2793 rebase.rebaseMerges
2794 </dt>
2795 <dd>
2797 Whether and how to set the <code>--rebase-merges</code> option by default. Can
2798 be <code>rebase-cousins</code>, <code>no-rebase-cousins</code>, or a boolean. Setting to
2799 true or to <code>no-rebase-cousins</code> is equivalent to
2800 <code>--rebase-merges=no-rebase-cousins</code>, setting to <code>rebase-cousins</code> is
2801 equivalent to <code>--rebase-merges=rebase-cousins</code>, and setting to false is
2802 equivalent to <code>--no-rebase-merges</code>. Passing <code>--rebase-merges</code> on the
2803 command line, with or without an argument, overrides any
2804 <code>rebase.rebaseMerges</code> configuration.
2805 </p>
2806 </dd>
2807 <dt class="hdlist1">
2808 rebase.maxLabelLength
2809 </dt>
2810 <dd>
2812 When generating label names from commit subjects, truncate the names to
2813 this length. By default, the names are truncated to a little less than
2814 <code>NAME_MAX</code> (to allow e.g. <code>.lock</code> files to be written for the
2815 corresponding loose refs).
2816 </p>
2817 </dd>
2818 <dt class="hdlist1">
2819 sequence.editor
2820 </dt>
2821 <dd>
2823 Text editor used by <code>git rebase -i</code> for editing the rebase instruction file.
2824 The value is meant to be interpreted by the shell when it is used.
2825 It can be overridden by the <code>GIT_SEQUENCE_EDITOR</code> environment variable.
2826 When not configured, the default commit message editor is used instead.
2827 </p>
2828 </dd>
2829 </dl></div>
2830 </div>
2831 </div>
2832 <div class="sect1">
2833 <h2 id="_git">GIT</h2>
2834 <div class="sectionbody">
2835 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
2836 </div>
2837 </div>
2838 </div>
2839 <div id="footnotes"><hr /></div>
2840 <div id="footer">
2841 <div id="footer-text">
2842 Last updated
2843 2024-04-03 15:35:56 PDT
2844 </div>
2845 </div>
2846 </body>
2847 </html>