2 <html xmlns=
"http://www.w3.org/1999/xhtml" lang=
"en">
4 <meta charset=
"UTF-8"/>
5 <meta http-equiv=
"X-UA-Compatible" content=
"IE=edge"/>
6 <meta name=
"viewport" content=
"width=device-width, initial-scale=1.0"/>
7 <meta name=
"generator" content=
"Asciidoctor 2.0.20"/>
8 <title>git-rebase(
1)
</title>
9 <link rel=
"stylesheet" href=
"https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700"/>
11 /*! Asciidoctor default stylesheet | MIT License | https://asciidoctor.org */
12 /* Uncomment the following line when using as a custom stylesheet */
13 /* @import
"https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700"; */
14 html{font-family:sans-serif;-webkit-text-size-adjust:
100%}
16 a:focus{outline:thin dotted}
17 a:active,a:hover{outline:
0}
18 h1{font-size:
2em;margin:
.67em
0}
19 b,strong{font-weight:bold}
21 abbr[title]{cursor:help;border-bottom:
1px dotted #dddddf;text-decoration:none}
22 dfn{font-style:italic}
24 mark{background:#ff0;color:#
000}
25 code,kbd,pre,samp{font-family:monospace;font-size:
1em}
26 pre{white-space:pre-wrap}
27 q{quotes:
"\201C" "\201D" "\2018" "\2019"}
29 sub,sup{font-size:
75%;line-height:
0;position:relative;vertical-align:baseline}
33 svg:not(:root){overflow:hidden}
35 audio,video{display:inline-block}
36 audio:not([controls]){display:none;height:
0}
37 fieldset{border:
1px solid silver;margin:
0 2px;padding:
.35em
.625em
.75em}
38 legend{border:
0;padding:
0}
39 button,input,select,textarea{font-family:inherit;font-size:
100%;margin:
0}
40 button,input{line-height:normal}
41 button,select{text-transform:none}
42 button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}
43 button[disabled],html input[disabled]{cursor:default}
44 input[type=checkbox],input[type=radio]{padding:
0}
45 button::-moz-focus-inner,input::-moz-focus-inner{border:
0;padding:
0}
46 textarea{overflow:auto;vertical-align:top}
47 table{border-collapse:collapse;border-spacing:
0}
48 *,::before,::after{box-sizing:border-box}
49 html,body{font-size:
100%}
50 body{background:#fff;color:rgba(
0,
0,
0,
.8);padding:
0;margin:
0;font-family:
"Noto Serif",
"DejaVu Serif",serif;line-height:
1;position:relative;cursor:auto;-moz-tab-size:
4;-o-tab-size:
4;tab-size:
4;word-wrap:anywhere;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}
51 a:hover{cursor:pointer}
52 img,object,embed{max-width:
100%;height:auto}
53 object,embed{height:
100%}
54 img{-ms-interpolation-mode:bicubic}
55 .left{float:left!important}
56 .right{float:right!important}
57 .text-left{text-align:left!important}
58 .text-right{text-align:right!important}
59 .text-center{text-align:center!important}
60 .text-justify{text-align:justify!important}
62 img,object,svg{display:inline-block;vertical-align:middle}
63 textarea{height:auto;min-height:
50px}
65 .subheader,.admonitionblock td.content
>.title,.audioblock
>.title,.exampleblock
>.title,.imageblock
>.title,.listingblock
>.title,.literalblock
>.title,.stemblock
>.title,.openblock
>.title,.paragraph
>.title,.quoteblock
>.title,table.tableblock
>.title,.verseblock
>.title,.videoblock
>.title,.dlist
>.title,.olist
>.title,.ulist
>.title,.qlist
>.title,.hdlist
>.title{line-height:
1.45;color:#
7a2518;font-weight:
400;margin-top:
0;margin-bottom:
.25em}
66 div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock
>.content
>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:
0;padding:
0}
67 a{color:#
2156a5;text-decoration:underline;line-height:inherit}
68 a:hover,a:focus{color:#
1d4b8f}
70 p{line-height:
1.6;margin-bottom:
1.25em;text-rendering:optimizeLegibility}
71 p aside{font-size:
.875em;line-height:
1.35;font-style:italic}
72 h1,h2,h3,#toctitle,.sidebarblock
>.content
>.title,h4,h5,h6{font-family:
"Open Sans",
"DejaVu Sans",sans-serif;font-weight:
300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:
1em;margin-bottom:
.5em;line-height:
1.0125em}
73 h1 small,h2 small,h3 small,#toctitle small,.sidebarblock
>.content
>.title small,h4 small,h5 small,h6 small{font-size:
60%;color:#e99b8f;line-height:
0}
75 h2{font-size:
1.6875em}
76 h3,#toctitle,.sidebarblock
>.content
>.title{font-size:
1.375em}
77 h4,h5{font-size:
1.125em}
79 hr{border:solid #dddddf;border-width:
1px
0 0;clear:both;margin:
1.25em
0 1.1875em}
80 em,i{font-style:italic;line-height:inherit}
81 strong,b{font-weight:bold;line-height:inherit}
82 small{font-size:
60%;line-height:inherit}
83 code{font-family:
"Droid Sans Mono",
"DejaVu Sans Mono",monospace;font-weight:
400;color:rgba(
0,
0,
0,
.9)}
84 ul,ol,dl{line-height:
1.6;margin-bottom:
1.25em;list-style-position:outside;font-family:inherit}
85 ul,ol{margin-left:
1.5em}
86 ul li ul,ul li ol{margin-left:
1.25em;margin-bottom:
0}
87 ul.circle{list-style-type:circle}
88 ul.disc{list-style-type:disc}
89 ul.square{list-style-type:square}
90 ul.circle ul:not([class]),ul.disc ul:not([class]),ul.square ul:not([class]){list-style:inherit}
91 ol li ul,ol li ol{margin-left:
1.25em;margin-bottom:
0}
92 dl dt{margin-bottom:
.3125em;font-weight:bold}
93 dl dd{margin-bottom:
1.25em}
94 blockquote{margin:
0 0 1.25em;padding:
.5625em
1.25em
0 1.1875em;border-left:
1px solid #ddd}
95 blockquote,blockquote p{line-height:
1.6;color:rgba(
0,
0,
0,
.85)}
96 @media screen and (min-width:
768px){h1,h2,h3,#toctitle,.sidebarblock
>.content
>.title,h4,h5,h6{line-height:
1.2}
98 h2{font-size:
2.3125em}
99 h3,#toctitle,.sidebarblock
>.content
>.title{font-size:
1.6875em}
100 h4{font-size:
1.4375em}}
101 table{background:#fff;margin-bottom:
1.25em;border:
1px solid #dedede;word-wrap:normal}
102 table thead,table tfoot{background:#f7f8f7}
103 table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:
.5em
.625em
.625em;font-size:inherit;color:rgba(
0,
0,
0,
.8);text-align:left}
104 table tr th,table tr td{padding:
.5625em
.625em;font-size:inherit;color:rgba(
0,
0,
0,
.8)}
105 table tr.even,table tr.alt{background:#f8f8f7}
106 table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{line-height:
1.6}
107 h1,h2,h3,#toctitle,.sidebarblock
>.content
>.title,h4,h5,h6{line-height:
1.2;word-spacing:-
.05em}
108 h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock
>.content
>.title strong,h4 strong,h5 strong,h6 strong{font-weight:
400}
109 .center{margin-left:auto;margin-right:auto}
111 .clearfix::before,.clearfix::after,.float-group::before,.float-group::after{content:
" ";display:table}
112 .clearfix::after,.float-group::after{clear:both}
113 :not(pre).nobreak{word-wrap:normal}
114 :not(pre).nowrap{white-space:nowrap}
115 :not(pre).pre-wrap{white-space:pre-wrap}
116 :not(pre):not([class^=L])
>code{font-size:
.9375em;font-style:normal!important;letter-spacing:
0;padding:
.1em
.5ex;word-spacing:-
.15em;background:#f7f7f8;border-radius:
4px;line-height:
1.45;text-rendering:optimizeSpeed}
117 pre{color:rgba(
0,
0,
0,
.9);font-family:
"Droid Sans Mono",
"DejaVu Sans Mono",monospace;line-height:
1.45;text-rendering:optimizeSpeed}
118 pre code,pre pre{color:inherit;font-size:inherit;line-height:inherit}
119 pre
>code{display:block}
120 pre.nowrap,pre.nowrap pre{white-space:pre;word-wrap:normal}
121 em em{font-style:normal}
122 strong strong{font-weight:
400}
123 .keyseq{color:rgba(
51,
51,
51,
.8)}
124 kbd{font-family:
"Droid Sans Mono",
"DejaVu Sans Mono",monospace;display:inline-block;color:rgba(
0,
0,
0,
.8);font-size:
.65em;line-height:
1.45;background:#f7f7f7;border:
1px solid #ccc;border-radius:
3px;box-shadow:
0 1px
0 rgba(
0,
0,
0,
.2),inset
0 0 0 .1em #fff;margin:
0 .15em;padding:
.2em
.5em;vertical-align:middle;position:relative;top:-
.1em;white-space:nowrap}
125 .keyseq kbd:first-child{margin-left:
0}
126 .keyseq kbd:last-child{margin-right:
0}
127 .menuseq,.menuref{color:#
000}
128 .menuseq b:not(.caret),.menuref{font-weight:inherit}
129 .menuseq{word-spacing:-
.02em}
130 .menuseq b.caret{font-size:
1.25em;line-height:
.8}
131 .menuseq i.caret{font-weight:bold;text-align:center;width:
.45em}
132 b.button::before,b.button::after{position:relative;top:-
1px;font-weight:
400}
133 b.button::before{content:
"[";padding:
0 3px
0 2px}
134 b.button::after{content:
"]";padding:
0 2px
0 3px}
135 p a
>code:hover{color:rgba(
0,
0,
0,
.9)}
136 #header,#content,#footnotes,#footer{width:
100%;margin:
0 auto;max-width:
62.5em;*zoom:
1;position:relative;padding-left:
.9375em;padding-right:
.9375em}
137 #header::before,#header::after,#content::before,#content::after,#footnotes::before,#footnotes::after,#footer::before,#footer::after{content:
" ";display:table}
138 #header::after,#content::after,#footnotes::after,#footer::after{clear:both}
139 #content{margin-top:
1.25em}
140 #content::before{content:none}
141 #header
>h1:first-child{color:rgba(
0,
0,
0,
.85);margin-top:
2.25rem;margin-bottom:
0}
142 #header
>h1:first-child+#toc{margin-top:
8px;border-top:
1px solid #dddddf}
143 #header
>h1:only-child,body.toc2 #header
>h1:nth-last-child(
2){border-bottom:
1px solid #dddddf;padding-bottom:
8px}
144 #header .details{border-bottom:
1px solid #dddddf;line-height:
1.45;padding-top:
.25em;padding-bottom:
.25em;padding-left:
.25em;color:rgba(
0,
0,
0,
.6);display:flex;flex-flow:row wrap}
145 #header .details span:first-child{margin-left:-
.125em}
146 #header .details span.email a{color:rgba(
0,
0,
0,
.85)}
147 #header .details br{display:none}
148 #header .details br+span::before{content:
"\00a0\2013\00a0"}
149 #header .details br+span.author::before{content:
"\00a0\22c5\00a0";color:rgba(
0,
0,
0,
.85)}
150 #header .details br+span#revremark::before{content:
"\00a0|\00a0"}
151 #header #revnumber{text-transform:capitalize}
152 #header #revnumber::after{content:
"\00a0"}
153 #content
>h1:first-child:not([class]){color:rgba(
0,
0,
0,
.85);border-bottom:
1px solid #dddddf;padding-bottom:
8px;margin-top:
0;padding-top:
1rem;margin-bottom:
1.25rem}
154 #toc{border-bottom:
1px solid #e7e7e9;padding-bottom:
.5em}
155 #toc
>ul{margin-left:
.125em}
156 #toc ul.sectlevel0
>li
>a{font-style:italic}
157 #toc ul.sectlevel0 ul.sectlevel1{margin:
.5em
0}
158 #toc ul{font-family:
"Open Sans",
"DejaVu Sans",sans-serif;list-style-type:none}
159 #toc li{line-height:
1.3334;margin-top:
.3334em}
160 #toc a{text-decoration:none}
161 #toc a:active{text-decoration:underline}
162 #toctitle{color:#
7a2518;font-size:
1.2em}
163 @media screen and (min-width:
768px){#toctitle{font-size:
1.375em}
164 body.toc2{padding-left:
15em;padding-right:
0}
165 #toc.toc2{margin-top:
0!important;background:#f8f8f7;position:fixed;width:
15em;left:
0;top:
0;border-right:
1px solid #e7e7e9;border-top-width:
0!important;border-bottom-width:
0!important;z-index:
1000;padding:
1.25em
1em;height:
100%;overflow:auto}
166 #toc.toc2 #toctitle{margin-top:
0;margin-bottom:
.8rem;font-size:
1.2em}
167 #toc.toc2
>ul{font-size:
.9em;margin-bottom:
0}
168 #toc.toc2 ul ul{margin-left:
0;padding-left:
1em}
169 #toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:
0;margin-top:
.5em;margin-bottom:
.5em}
170 body.toc2.toc-right{padding-left:
0;padding-right:
15em}
171 body.toc2.toc-right #toc.toc2{border-right-width:
0;border-left:
1px solid #e7e7e9;left:auto;right:
0}}
172 @media screen and (min-width:
1280px){body.toc2{padding-left:
20em;padding-right:
0}
173 #toc.toc2{width:
20em}
174 #toc.toc2 #toctitle{font-size:
1.375em}
175 #toc.toc2
>ul{font-size:
.95em}
176 #toc.toc2 ul ul{padding-left:
1.25em}
177 body.toc2.toc-right{padding-left:
0;padding-right:
20em}}
178 #content #toc{border:
1px solid #e0e0dc;margin-bottom:
1.25em;padding:
1.25em;background:#f8f8f7;border-radius:
4px}
179 #content #toc
>:first-child{margin-top:
0}
180 #content #toc
>:last-child{margin-bottom:
0}
181 #footer{max-width:none;background:rgba(
0,
0,
0,
.8);padding:
1.25em}
182 #footer-text{color:hsla(
0,
0%,
100%,
.8);line-height:
1.44}
183 #content{margin-bottom:
.625em}
184 .sect1{padding-bottom:
.625em}
185 @media screen and (min-width:
768px){#content{margin-bottom:
1.25em}
186 .sect1{padding-bottom:
1.25em}}
187 .sect1:last-child{padding-bottom:
0}
188 .sect1+.sect1{border-top:
1px solid #e7e7e9}
189 #content h1
>a.anchor,h2
>a.anchor,h3
>a.anchor,#toctitle
>a.anchor,.sidebarblock
>.content
>.title
>a.anchor,h4
>a.anchor,h5
>a.anchor,h6
>a.anchor{position:absolute;z-index:
1001;width:
1.5ex;margin-left:-
1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:
400}
190 #content h1
>a.anchor::before,h2
>a.anchor::before,h3
>a.anchor::before,#toctitle
>a.anchor::before,.sidebarblock
>.content
>.title
>a.anchor::before,h4
>a.anchor::before,h5
>a.anchor::before,h6
>a.anchor::before{content:
"\00A7";font-size:
.85em;display:block;padding-top:
.1em}
191 #content h1:hover
>a.anchor,#content h1
>a.anchor:hover,h2:hover
>a.anchor,h2
>a.anchor:hover,h3:hover
>a.anchor,#toctitle:hover
>a.anchor,.sidebarblock
>.content
>.title:hover
>a.anchor,h3
>a.anchor:hover,#toctitle
>a.anchor:hover,.sidebarblock
>.content
>.title
>a.anchor:hover,h4:hover
>a.anchor,h4
>a.anchor:hover,h5:hover
>a.anchor,h5
>a.anchor:hover,h6:hover
>a.anchor,h6
>a.anchor:hover{visibility:visible}
192 #content h1
>a.link,h2
>a.link,h3
>a.link,#toctitle
>a.link,.sidebarblock
>.content
>.title
>a.link,h4
>a.link,h5
>a.link,h6
>a.link{color:#ba3925;text-decoration:none}
193 #content h1
>a.link:hover,h2
>a.link:hover,h3
>a.link:hover,#toctitle
>a.link:hover,.sidebarblock
>.content
>.title
>a.link:hover,h4
>a.link:hover,h5
>a.link:hover,h6
>a.link:hover{color:#a53221}
194 details,.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:
1.25em}
195 details{margin-left:
1.25rem}
196 details
>summary{cursor:pointer;display:block;position:relative;line-height:
1.6;margin-bottom:
.625rem;outline:none;-webkit-tap-highlight-color:transparent}
197 details
>summary::-webkit-details-marker{display:none}
198 details
>summary::before{content:
"";border:solid transparent;border-left:solid;border-width:
.3em
0 .3em
.5em;position:absolute;top:
.5em;left:-
1.25rem;transform:translateX(
15%)}
199 details[open]
>summary::before{border:solid transparent;border-top:solid;border-width:
.5em
.3em
0;transform:translateY(
15%)}
200 details
>summary::after{content:
"";width:
1.25rem;height:
1em;position:absolute;top:
.3em;left:-
1.25rem}
201 .admonitionblock td.content
>.title,.audioblock
>.title,.exampleblock
>.title,.imageblock
>.title,.listingblock
>.title,.literalblock
>.title,.stemblock
>.title,.openblock
>.title,.paragraph
>.title,.quoteblock
>.title,table.tableblock
>.title,.verseblock
>.title,.videoblock
>.title,.dlist
>.title,.olist
>.title,.ulist
>.title,.qlist
>.title,.hdlist
>.title{text-rendering:optimizeLegibility;text-align:left;font-family:
"Noto Serif",
"DejaVu Serif",serif;font-size:
1rem;font-style:italic}
202 table.tableblock.fit-content
>caption.title{white-space:nowrap;width:
0}
203 .paragraph.lead
>p,#preamble
>.sectionbody
>[class=paragraph]:first-of-type p{font-size:
1.21875em;line-height:
1.6;color:rgba(
0,
0,
0,
.85)}
204 .admonitionblock
>table{border-collapse:separate;border:
0;background:none;width:
100%}
205 .admonitionblock
>table td.icon{text-align:center;width:
80px}
206 .admonitionblock
>table td.icon img{max-width:none}
207 .admonitionblock
>table td.icon .title{font-weight:bold;font-family:
"Open Sans",
"DejaVu Sans",sans-serif;text-transform:uppercase}
208 .admonitionblock
>table td.content{padding-left:
1.125em;padding-right:
1.25em;border-left:
1px solid #dddddf;color:rgba(
0,
0,
0,
.6);word-wrap:anywhere}
209 .admonitionblock
>table td.content
>:last-child
>:last-child{margin-bottom:
0}
210 .exampleblock
>.content{border:
1px solid #e6e6e6;margin-bottom:
1.25em;padding:
1.25em;background:#fff;border-radius:
4px}
211 .sidebarblock{border:
1px solid #dbdbd6;margin-bottom:
1.25em;padding:
1.25em;background:#f3f3f2;border-radius:
4px}
212 .sidebarblock
>.content
>.title{color:#
7a2518;margin-top:
0;text-align:center}
213 .exampleblock
>.content
>:first-child,.sidebarblock
>.content
>:first-child{margin-top:
0}
214 .exampleblock
>.content
>:last-child,.exampleblock
>.content
>:last-child
>:last-child,.exampleblock
>.content .olist
>ol
>li:last-child
>:last-child,.exampleblock
>.content .ulist
>ul
>li:last-child
>:last-child,.exampleblock
>.content .qlist
>ol
>li:last-child
>:last-child,.sidebarblock
>.content
>:last-child,.sidebarblock
>.content
>:last-child
>:last-child,.sidebarblock
>.content .olist
>ol
>li:last-child
>:last-child,.sidebarblock
>.content .ulist
>ul
>li:last-child
>:last-child,.sidebarblock
>.content .qlist
>ol
>li:last-child
>:last-child{margin-bottom:
0}
215 .literalblock pre,.listingblock
>.content
>pre{border-radius:
4px;overflow-x:auto;padding:
1em;font-size:
.8125em}
216 @media screen and (min-width:
768px){.literalblock pre,.listingblock
>.content
>pre{font-size:
.90625em}}
217 @media screen and (min-width:
1280px){.literalblock pre,.listingblock
>.content
>pre{font-size:
1em}}
218 .literalblock pre,.listingblock
>.content
>pre:not(.highlight),.listingblock
>.content
>pre[class=highlight],.listingblock
>.content
>pre[class^=
"highlight "]{background:#f7f7f8}
219 .literalblock.output pre{color:#f7f7f8;background:rgba(
0,
0,
0,
.9)}
220 .listingblock
>.content{position:relative}
221 .listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:
.75em;top:
.425rem;right:
.5rem;line-height:
1;text-transform:uppercase;color:inherit;opacity:
.5}
222 .listingblock:hover code[data-lang]::before{display:block}
223 .listingblock.terminal pre .command::before{content:attr(data-prompt);padding-right:
.5em;color:inherit;opacity:
.5}
224 .listingblock.terminal pre .command:not([data-prompt])::before{content:
"$"}
225 .listingblock pre.highlightjs{padding:
0}
226 .listingblock pre.highlightjs
>code{padding:
1em;border-radius:
4px}
227 .listingblock pre.prettyprint{border-width:
0}
228 .prettyprint{background:#f7f7f8}
229 pre.prettyprint .linenums{line-height:
1.45;margin-left:
2em}
230 pre.prettyprint li{background:none;list-style-type:inherit;padding-left:
0}
231 pre.prettyprint li code[data-lang]::before{opacity:
1}
232 pre.prettyprint li:not(:first-child) code[data-lang]::before{display:none}
233 table.linenotable{border-collapse:separate;border:
0;margin-bottom:
0;background:none}
234 table.linenotable td[class]{color:inherit;vertical-align:top;padding:
0;line-height:inherit;white-space:normal}
235 table.linenotable td.code{padding-left:
.75em}
236 table.linenotable td.linenos,pre.pygments .linenos{border-right:
1px solid;opacity:
.35;padding-right:
.5em;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
237 pre.pygments span.linenos{display:inline-block;margin-right:
.75em}
238 .quoteblock{margin:
0 1em
1.25em
1.5em;display:table}
239 .quoteblock:not(.excerpt)
>.title{margin-left:-
1.5em;margin-bottom:
.75em}
240 .quoteblock blockquote,.quoteblock p{color:rgba(
0,
0,
0,
.85);font-size:
1.15rem;line-height:
1.75;word-spacing:
.1em;letter-spacing:
0;font-style:italic;text-align:justify}
241 .quoteblock blockquote{margin:
0;padding:
0;border:
0}
242 .quoteblock blockquote::before{content:
"\201c";float:left;font-size:
2.75em;font-weight:bold;line-height:
.6em;margin-left:-
.6em;color:#
7a2518;text-shadow:
0 1px
2px rgba(
0,
0,
0,
.1)}
243 .quoteblock blockquote
>.paragraph:last-child p{margin-bottom:
0}
244 .quoteblock .attribution{margin-top:
.75em;margin-right:
.5ex;text-align:right}
245 .verseblock{margin:
0 1em
1.25em}
246 .verseblock pre{font-family:
"Open Sans",
"DejaVu Sans",sans-serif;font-size:
1.15rem;color:rgba(
0,
0,
0,
.85);font-weight:
300;text-rendering:optimizeLegibility}
247 .verseblock pre strong{font-weight:
400}
248 .verseblock .attribution{margin-top:
1.25rem;margin-left:
.5ex}
249 .quoteblock .attribution,.verseblock .attribution{font-size:
.9375em;line-height:
1.45;font-style:italic}
250 .quoteblock .attribution br,.verseblock .attribution br{display:none}
251 .quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-
.025em;color:rgba(
0,
0,
0,
.6)}
252 .quoteblock.abstract blockquote::before,.quoteblock.excerpt blockquote::before,.quoteblock .quoteblock blockquote::before{display:none}
253 .quoteblock.abstract blockquote,.quoteblock.abstract p,.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{line-height:
1.6;word-spacing:
0}
254 .quoteblock.abstract{margin:
0 1em
1.25em;display:block}
255 .quoteblock.abstract
>.title{margin:
0 0 .375em;font-size:
1.15em;text-align:center}
256 .quoteblock.excerpt
>blockquote,.quoteblock .quoteblock{padding:
0 0 .25em
1em;border-left:
.25em solid #dddddf}
257 .quoteblock.excerpt,.quoteblock .quoteblock{margin-left:
0}
258 .quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{color:inherit;font-size:
1.0625rem}
259 .quoteblock.excerpt .attribution,.quoteblock .quoteblock .attribution{color:inherit;font-size:
.85rem;text-align:left;margin-right:
0}
260 p.tableblock:last-child{margin-bottom:
0}
261 td.tableblock
>.content{margin-bottom:
1.25em;word-wrap:anywhere}
262 td.tableblock
>.content
>:last-child{margin-bottom:-
1.25em}
263 table.tableblock,th.tableblock,td.tableblock{border:
0 solid #dedede}
264 table.grid-all
>*
>tr
>*{border-width:
1px}
265 table.grid-cols
>*
>tr
>*{border-width:
0 1px}
266 table.grid-rows
>*
>tr
>*{border-width:
1px
0}
267 table.frame-all{border-width:
1px}
268 table.frame-ends{border-width:
1px
0}
269 table.frame-sides{border-width:
0 1px}
270 table.frame-none
>colgroup+*
>:first-child
>*,table.frame-sides
>colgroup+*
>:first-child
>*{border-top-width:
0}
271 table.frame-none
>:last-child
>:last-child
>*,table.frame-sides
>:last-child
>:last-child
>*{border-bottom-width:
0}
272 table.frame-none
>*
>tr
>:first-child,table.frame-ends
>*
>tr
>:first-child{border-left-width:
0}
273 table.frame-none
>*
>tr
>:last-child,table.frame-ends
>*
>tr
>:last-child{border-right-width:
0}
274 table.stripes-all
>*
>tr,table.stripes-odd
>*
>tr:nth-of-type(odd),table.stripes-even
>*
>tr:nth-of-type(even),table.stripes-hover
>*
>tr:hover{background:#f8f8f7}
275 th.halign-left,td.halign-left{text-align:left}
276 th.halign-right,td.halign-right{text-align:right}
277 th.halign-center,td.halign-center{text-align:center}
278 th.valign-top,td.valign-top{vertical-align:top}
279 th.valign-bottom,td.valign-bottom{vertical-align:bottom}
280 th.valign-middle,td.valign-middle{vertical-align:middle}
281 table thead th,table tfoot th{font-weight:bold}
282 tbody tr th{background:#f7f8f7}
283 tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(
0,
0,
0,
.8);font-weight:bold}
284 p.tableblock
>code:only-child{background:none;padding:
0}
285 p.tableblock{font-size:
1em}
286 ol{margin-left:
1.75em}
287 ul li ol{margin-left:
1.5em}
288 dl dd{margin-left:
1.125em}
289 dl dd:last-child,dl dd:last-child
>:last-child{margin-bottom:
0}
290 li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:
.625em}
291 ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none}
292 ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:
.625em}
293 ul.unstyled,ol.unstyled{margin-left:
0}
294 li
>p:empty:only-child::before{content:
"";display:inline-block}
295 ul.checklist
>li
>p:first-child{margin-left:-
1em}
296 ul.checklist
>li
>p:first-child
>.fa-square-o:first-child,ul.checklist
>li
>p:first-child
>.fa-check-square-o:first-child{width:
1.25em;font-size:
.8em;position:relative;bottom:
.125em}
297 ul.checklist
>li
>p:first-child
>input[type=checkbox]:first-child{margin-right:
.25em}
298 ul.inline{display:flex;flex-flow:row wrap;list-style:none;margin:
0 0 .625em -
1.25em}
299 ul.inline
>li{margin-left:
1.25em}
300 .unstyled dl dt{font-weight:
400;font-style:normal}
301 ol.arabic{list-style-type:decimal}
302 ol.decimal{list-style-type:decimal-leading-zero}
303 ol.loweralpha{list-style-type:lower-alpha}
304 ol.upperalpha{list-style-type:upper-alpha}
305 ol.lowerroman{list-style-type:lower-roman}
306 ol.upperroman{list-style-type:upper-roman}
307 ol.lowergreek{list-style-type:lower-greek}
308 .hdlist
>table,.colist
>table{border:
0;background:none}
309 .hdlist
>table
>tbody
>tr,.colist
>table
>tbody
>tr{background:none}
310 td.hdlist1,td.hdlist2{vertical-align:top;padding:
0 .625em}
311 td.hdlist1{font-weight:bold;padding-bottom:
1.25em}
312 td.hdlist2{word-wrap:anywhere}
313 .literalblock+.colist,.listingblock+.colist{margin-top:-
.5em}
314 .colist td:not([class]):first-child{padding:
.4em
.75em
0;line-height:
1;vertical-align:top}
315 .colist td:not([class]):first-child img{max-width:none}
316 .colist td:not([class]):last-child{padding:
.25em
0}
317 .thumb,.th{line-height:
0;display:inline-block;border:
4px solid #fff;box-shadow:
0 0 0 1px #ddd}
318 .imageblock.left{margin:
.25em
.625em
1.25em
0}
319 .imageblock.right{margin:
.25em
0 1.25em
.625em}
320 .imageblock
>.title{margin-bottom:
0}
321 .imageblock.thumb,.imageblock.th{border-width:
6px}
322 .imageblock.thumb
>.title,.imageblock.th
>.title{padding:
0 .125em}
323 .image.left,.image.right{margin-top:
.25em;margin-bottom:
.25em;display:inline-block;line-height:
0}
324 .image.left{margin-right:
.625em}
325 .image.right{margin-left:
.625em}
326 a.image{text-decoration:none;display:inline-block}
327 a.image object{pointer-events:none}
328 sup.footnote,sup.footnoteref{font-size:
.875em;position:static;vertical-align:super}
329 sup.footnote a,sup.footnoteref a{text-decoration:none}
330 sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline}
331 #footnotes{padding-top:
.75em;padding-bottom:
.75em;margin-bottom:
.625em}
332 #footnotes hr{width:
20%;min-width:
6.25em;margin:-
.25em
0 .75em;border-width:
1px
0 0}
333 #footnotes .footnote{padding:
0 .375em
0 .225em;line-height:
1.3334;font-size:
.875em;margin-left:
1.2em;margin-bottom:
.2em}
334 #footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none;margin-left:-
1.05em}
335 #footnotes .footnote:last-of-type{margin-bottom:
0}
336 #content #footnotes{margin-top:-
.625em;margin-bottom:
0;padding:
.75em
0}
337 div.unbreakable{page-break-inside:avoid}
338 .big{font-size:larger}
339 .small{font-size:smaller}
340 .underline{text-decoration:underline}
341 .overline{text-decoration:overline}
342 .line-through{text-decoration:line-through}
344 .aqua-background{background:#
00fafa}
346 .black-background{background:#
000}
348 .blue-background{background:#
0000fa}
349 .fuchsia{color:#bf00bf}
350 .fuchsia-background{background:#fa00fa}
352 .gray-background{background:#
7d7d7d}
353 .green{color:#
006000}
354 .green-background{background:#
007d00}
356 .lime-background{background:#
00fa00}
357 .maroon{color:#
600000}
358 .maroon-background{background:#
7d0000}
360 .navy-background{background:#
00007d}
361 .olive{color:#
606000}
362 .olive-background{background:#
7d7d00}
363 .purple{color:#
600060}
364 .purple-background{background:#
7d007d}
366 .red-background{background:#fa0000}
367 .silver{color:#
909090}
368 .silver-background{background:#bcbcbc}
370 .teal-background{background:#
007d7d}
371 .white{color:#bfbfbf}
372 .white-background{background:#fafafa}
373 .yellow{color:#bfbf00}
374 .yellow-background{background:#fafa00}
375 span.icon
>.fa{cursor:default}
376 a span.icon
>.fa{cursor:inherit}
377 .admonitionblock td.icon [class^=
"fa icon-"]{font-size:
2.5em;text-shadow:
1px
1px
2px rgba(
0,
0,
0,
.5);cursor:default}
378 .admonitionblock td.icon .icon-note::before{content:
"\f05a";color:#
19407c}
379 .admonitionblock td.icon .icon-tip::before{content:
"\f0eb";text-shadow:
1px
1px
2px rgba(
155,
155,
0,
.8);color:#
111}
380 .admonitionblock td.icon .icon-warning::before{content:
"\f071";color:#bf6900}
381 .admonitionblock td.icon .icon-caution::before{content:
"\f06d";color:#bf3400}
382 .admonitionblock td.icon .icon-important::before{content:
"\f06a";color:#bf0000}
383 .conum[data-value]{display:inline-block;color:#fff!important;background:rgba(
0,
0,
0,
.8);border-radius:
50%;text-align:center;font-size:
.75em;width:
1.67em;height:
1.67em;line-height:
1.67em;font-family:
"Open Sans",
"DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
384 .conum[data-value] *{color:#fff!important}
385 .conum[data-value]+b{display:none}
386 .conum[data-value]::after{content:attr(data-value)}
387 pre .conum[data-value]{position:relative;top:-
.125em}
388 b.conum *{color:inherit!important}
389 .conum:not([data-value]):empty{display:none}
390 dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility}
391 h1,h2,p,td.content,span.alt,summary{letter-spacing:-
.01em}
392 p strong,td.content strong,div.footnote strong{letter-spacing:-
.005em}
393 p,blockquote,dt,td.content,td.hdlist1,span.alt,summary{font-size:
1.0625rem}
394 p{margin-bottom:
1.25rem}
395 .sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:
1em}
396 .exampleblock
>.content{background:#fffef7;border-color:#e0e0dc;box-shadow:
0 1px
4px #e0e0dc}
397 .print-only{display:none!important}
398 @page{margin:
1.25cm
.75cm}
399 @media print{*{box-shadow:none!important;text-shadow:none!important}
401 a{color:inherit!important;text-decoration:underline!important}
402 a.bare,a[href^=
"#"],a[href^=
"mailto:"]{text-decoration:none!important}
403 a[href^=
"http:"]:not(.bare)::after,a[href^=
"https:"]:not(.bare)::after{content:
"(" attr(href)
")";display:inline-block;font-size:
.875em;padding-left:
.25em}
404 abbr[title]{border-bottom:
1px dotted}
405 abbr[title]::after{content:
" (" attr(title)
")"}
406 pre,blockquote,tr,img,object,svg{page-break-inside:avoid}
407 thead{display:table-header-group}
409 p,blockquote,dt,td.content{font-size:
1em;orphans:
3;widows:
3}
410 h2,h3,#toctitle,.sidebarblock
>.content
>.title{page-break-after:avoid}
411 #header,#content,#footnotes,#footer{max-width:none}
412 #toc,.sidebarblock,.exampleblock
>.content{background:none!important}
413 #toc{border-bottom:
1px solid #dddddf!important;padding-bottom:
0!important}
414 body.book #header{text-align:center}
415 body.book #header
>h1:first-child{border:
0!important;margin:
2.5em
0 1em}
416 body.book #header .details{border:
0!important;display:block;padding:
0!important}
417 body.book #header .details span:first-child{margin-left:
0!important}
418 body.book #header .details br{display:block}
419 body.book #header .details br+span::before{content:none!important}
420 body.book #toc{border:
0!important;text-align:left!important;padding:
0!important;margin:
0!important}
421 body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1
>h2{page-break-before:always}
422 .listingblock code[data-lang]::before{display:block}
423 #footer{padding:
0 .9375em}
424 .hide-on-print{display:none!important}
425 .print-only{display:block!important}
426 .hide-for-print{display:none!important}
427 .show-for-print{display:inherit!important}}
428 @media amzn-kf8,print{#header
>h1:first-child{margin-top:
1.25rem}
429 .sect1{padding:
0!important}
430 .sect1+.sect1{border:
0}
431 #footer{background:none}
432 #footer-text{color:rgba(
0,
0,
0,
.6);font-size:
.9em}}
433 @media amzn-kf8{#header,#content,#footnotes,#footer{padding:
0}}
441 <body class=
"manpage">
443 <h1>git-rebase(
1) Manual Page
</h1>
444 <h2 id=
"_name">NAME
</h2>
445 <div class=
"sectionbody">
446 <p>git-rebase - Reapply commits on top of another base tip
</p>
451 <h2 id=
"_synopsis">SYNOPSIS
</h2>
452 <div class=
"sectionbody">
453 <div class=
"verseblock">
454 <pre class=
"content"><em>git rebase
</em> [-i | --interactive] [
<options
>] [--exec
<cmd
>]
455 [--onto
<newbase
> | --keep-base] [
<upstream
> [
<branch
>]]
456 <em>git rebase
</em> [-i | --interactive] [
<options
>] [--exec
<cmd
>] [--onto
<newbase
>]
457 --root [
<branch
>]
458 <em>git rebase
</em> (--continue|--skip|--abort|--quit|--edit-todo|--show-current-patch)
</pre>
463 <h2 id=
"_description">DESCRIPTION
</h2>
464 <div class=
"sectionbody">
465 <div class=
"paragraph">
466 <p>If
<em><branch
></em> is specified,
<code>git
</code> <code>rebase
</code> will perform an automatic
467 <code>git
</code> <code>switch
</code> <em><branch
></em> before doing anything else. Otherwise
468 it remains on the current branch.
</p>
470 <div class=
"paragraph">
471 <p>If
<em><upstream
></em> is not specified, the upstream configured in
472 <code>branch.
</code><em><name
></em><code>.remote
</code> and
<code>branch.
</code><em><name
></em><code>.merge
</code> options will be used (see
473 <a href=
"git-config.html">git-config(
1)
</a> for details) and the
<code>--fork-point
</code> option is
474 assumed. If you are currently not on any branch or if the current
475 branch does not have a configured upstream, the rebase will abort.
</p>
477 <div class=
"paragraph">
478 <p>All changes made by commits in the current branch but that are not
479 in
<em><upstream
></em> are saved to a temporary area. This is the same set
480 of commits that would be shown by
<code>git
</code> <code>log
</code> <em><upstream
></em><code>..
</code><code>HEAD
</code>; or by
481 <code>git
</code> <code>log
</code> 'fork_point'
<code>..
</code><code>HEAD
</code>, if
<code>--fork-point
</code> is active (see the
482 description on
<code>--fork-point
</code> below); or by
<code>git
</code> <code>log
</code> <code>HEAD
</code>, if the
483 <code>--root
</code> option is specified.
</p>
485 <div class=
"paragraph">
486 <p>The current branch is reset to
<em><upstream
></em> or
<em><newbase
></em> if the
487 <code>--onto
</code> option was supplied. This has the exact same effect as
488 <code>git
</code> <code>reset
</code> <code>--hard
</code> <em><upstream
></em> (or
<em><newbase
></em>).
<code>ORIG_HEAD
</code> is set
489 to point at the tip of the branch before the reset.
</p>
491 <div class=
"admonitionblock note">
495 <div class=
"title">Note
</div>
498 <code>ORIG_HEAD
</code> is not guaranteed to still point to the previous branch tip
499 at the end of the rebase if other commands that write that pseudo-ref
500 (e.g.
<code>git
</code> <code>reset
</code>) are used during the rebase. The previous branch tip,
501 however, is accessible using the reflog of the current branch
502 (i.e.
<code>@
</code>{
1}, see
<a href=
"gitrevisions.html">gitrevisions(
7)
</a>).
507 <div class=
"paragraph">
508 <p>The commits that were previously saved into the temporary area are
509 then reapplied to the current branch, one by one, in order. Note that
510 any commits in
<code>HEAD
</code> which introduce the same textual changes as a commit
511 in
<code>HEAD
</code><code>..
</code><em><upstream
></em> are omitted (i.e., a patch already accepted upstream
512 with a different commit message or timestamp will be skipped).
</p>
514 <div class=
"paragraph">
515 <p>It is possible that a merge failure will prevent this process from being
516 completely automatic. You will have to resolve any such merge failure
517 and run
<code>git
</code> <code>rebase
</code> <code>--continue
</code>. Another option is to bypass the commit
518 that caused the merge failure with
<code>git
</code> <code>rebase
</code> <code>--skip
</code>. To check out the
519 original
<em><branch
></em> and remove the .
<code>git/rebase-apply
</code> working files, use
520 the command
<code>git
</code> <code>rebase
</code> <code>--abort
</code> instead.
</p>
522 <div class=
"paragraph">
523 <p>Assume the following history exists and the current branch is
"topic":
</p>
525 <div class=
"listingblock">
526 <div class=
"content">
527 <pre> A---B---C topic
529 D---E---F---G master
</pre>
532 <div class=
"paragraph">
533 <p>From this point, the result of either of the following commands:
</p>
535 <div class=
"literalblock">
536 <div class=
"content">
537 <pre>git rebase master
538 git rebase master topic
</pre>
541 <div class=
"paragraph">
544 <div class=
"listingblock">
545 <div class=
"content">
546 <pre> A'--B'--C' topic
548 D---E---F---G master
</pre>
551 <div class=
"paragraph">
552 <p><strong>NOTE:
</strong> The latter form is just a short-hand of
<code>git
</code> <code>checkout
</code> <code>topic
</code>
553 followed by
<code>git
</code> <code>rebase
</code> <code>master
</code>. When rebase exits
<code>topic
</code> will
554 remain the checked-out branch.
</p>
556 <div class=
"paragraph">
557 <p>If the upstream branch already contains a change you have made (e.g.,
558 because you mailed a patch which was applied upstream), then that commit
559 will be skipped and warnings will be issued (if the
<em>merge
</em> backend is
560 used). For example, running
<code>git
</code> <code>rebase
</code> <code>master
</code> on the following
561 history (in which
<code>A
</code>' and
<code>A
</code> introduce the same set of changes, but
562 have different committer information):
</p>
564 <div class=
"listingblock">
565 <div class=
"content">
566 <pre> A---B---C topic
568 D---E---A'---F master
</pre>
571 <div class=
"paragraph">
572 <p>will result in:
</p>
574 <div class=
"listingblock">
575 <div class=
"content">
578 D---E---A'---F master
</pre>
581 <div class=
"paragraph">
582 <p>Here is how you would transplant a topic branch based on one
583 branch to another, to pretend that you forked the topic branch
584 from the latter branch, using
<code>rebase
</code> <code>--onto
</code>.
</p>
586 <div class=
"paragraph">
587 <p>First let
’s assume your
<em>topic
</em> is based on branch
<em>next
</em>.
588 For example, a feature developed in
<em>topic
</em> depends on some
589 functionality which is found in
<em>next
</em>.
</p>
591 <div class=
"listingblock">
592 <div class=
"content">
593 <pre> o---o---o---o---o master
595 o---o---o---o---o next
597 o---o---o topic
</pre>
600 <div class=
"paragraph">
601 <p>We want to make
<em>topic
</em> forked from branch
<em>master
</em>; for example,
602 because the functionality on which
<em>topic
</em> depends was merged into the
603 more stable
<em>master
</em> branch. We want our tree to look like this:
</p>
605 <div class=
"listingblock">
606 <div class=
"content">
607 <pre> o---o---o---o---o master
611 o---o---o---o---o next
</pre>
614 <div class=
"paragraph">
615 <p>We can get this using the following command:
</p>
617 <div class=
"literalblock">
618 <div class=
"content">
619 <pre>git rebase --onto master next topic
</pre>
622 <div class=
"paragraph">
623 <p>Another example of --onto option is to rebase part of a
624 branch. If we have the following situation:
</p>
626 <div class=
"listingblock">
627 <div class=
"content">
628 <pre> H---I---J topicB
632 A---B---C---D master
</pre>
635 <div class=
"paragraph">
636 <p>then the command
</p>
638 <div class=
"literalblock">
639 <div class=
"content">
640 <pre>git rebase --onto master topicA topicB
</pre>
643 <div class=
"paragraph">
644 <p>would result in:
</p>
646 <div class=
"listingblock">
647 <div class=
"content">
648 <pre> H'--I'--J' topicB
652 A---B---C---D master
</pre>
655 <div class=
"paragraph">
656 <p>This is useful when topicB does not depend on topicA.
</p>
658 <div class=
"paragraph">
659 <p>A range of commits could also be removed with rebase. If we have
660 the following situation:
</p>
662 <div class=
"listingblock">
663 <div class=
"content">
664 <pre> E---F---G---H---I---J topicA
</pre>
667 <div class=
"paragraph">
668 <p>then the command
</p>
670 <div class=
"literalblock">
671 <div class=
"content">
672 <pre>git rebase --onto topicA~
5 topicA~
3 topicA
</pre>
675 <div class=
"paragraph">
676 <p>would result in the removal of commits F and G:
</p>
678 <div class=
"listingblock">
679 <div class=
"content">
680 <pre> E---H'---I'---J' topicA
</pre>
683 <div class=
"paragraph">
684 <p>This is useful if F and G were flawed in some way, or should not be
685 part of topicA. Note that the argument to
<code>--onto
</code> and the
<em><upstream
></em>
686 parameter can be any valid commit-ish.
</p>
688 <div class=
"paragraph">
689 <p>In case of conflict,
<code>git
</code> <code>rebase
</code> will stop at the first problematic commit
690 and leave conflict markers in the tree. You can use
<code>git
</code> <code>diff
</code> to locate
691 the markers (
<<<<<<) and make edits to resolve the conflict. For each
692 file you edit, you need to tell Git that the conflict has been resolved,
693 typically this would be done with
</p>
695 <div class=
"literalblock">
696 <div class=
"content">
697 <pre>git add
<filename
></pre>
700 <div class=
"paragraph">
701 <p>After resolving the conflict manually and updating the index with the
702 desired resolution, you can continue the rebasing process with
</p>
704 <div class=
"literalblock">
705 <div class=
"content">
706 <pre>git rebase --continue
</pre>
709 <div class=
"paragraph">
710 <p>Alternatively, you can undo the
<em>git rebase
</em> with
</p>
712 <div class=
"literalblock">
713 <div class=
"content">
714 <pre>git rebase --abort
</pre>
720 <h2 id=
"_mode_options">MODE OPTIONS
</h2>
721 <div class=
"sectionbody">
722 <div class=
"paragraph">
723 <p>The options in this section cannot be used with any other option,
724 including not with each other:
</p>
728 <dt class=
"hdlist1">--continue
</dt>
730 <p>Restart the rebasing process after having resolved a merge conflict.
</p>
732 <dt class=
"hdlist1">--skip
</dt>
734 <p>Restart the rebasing process by skipping the current patch.
</p>
736 <dt class=
"hdlist1">--abort
</dt>
738 <p>Abort the rebase operation and reset HEAD to the original
739 branch. If
<em><branch
></em> was provided when the rebase operation was
740 started, then
<code>HEAD
</code> will be reset to
<em><branch
></em>. Otherwise
<code>HEAD
</code>
741 will be reset to where it was when the rebase operation was
744 <dt class=
"hdlist1">--quit
</dt>
746 <p>Abort the rebase operation but
<code>HEAD
</code> is not reset back to the
747 original branch. The index and working tree are also left
748 unchanged as a result. If a temporary stash entry was created
749 using
<code>--autostash
</code>, it will be saved to the stash list.
</p>
751 <dt class=
"hdlist1">--edit-todo
</dt>
753 <p>Edit the todo list during an interactive rebase.
</p>
755 <dt class=
"hdlist1">--show-current-patch
</dt>
757 <p>Show the current patch in an interactive rebase or when rebase
758 is stopped because of conflicts. This is the equivalent of
759 <code>git
</code> <code>show
</code> <code>REBASE_HEAD
</code>.
</p>
766 <h2 id=
"_options">OPTIONS
</h2>
767 <div class=
"sectionbody">
770 <dt class=
"hdlist1">--onto
<newbase
></dt>
772 <p>Starting point at which to create the new commits. If the
773 <code>--onto
</code> option is not specified, the starting point is
774 <em><upstream
></em>. May be any valid commit, and not just an
775 existing branch name.
</p>
776 <div class=
"paragraph">
777 <p>As a special case, you may use
"A...B" as a shortcut for the
778 merge base of A and B if there is exactly one merge base. You can
779 leave out at most one of A and B, in which case it defaults to HEAD.
</p>
782 <dt class=
"hdlist1">--keep-base
</dt>
784 <p>Set the starting point at which to create the new commits to the
785 merge base of
<em><upstream
></em> and
<em><branch
></em>. Running
786 <code>git
</code> <code>rebase
</code> <code>--keep-base
</code> <em><upstream
></em> <em><branch
></em> is equivalent to
788 <code>git
</code> <code>rebase
</code> <code>--reapply-cherry-picks
</code> <code>--no-fork-point
</code> <code>--onto
</code> <em><upstream
></em><code>...
</code><em><branch
></em> <em><upstream
></em> <em><branch
></em>.
</p>
789 <div class=
"paragraph">
790 <p>This option is useful in the case where one is developing a feature on
791 top of an upstream branch. While the feature is being worked on, the
792 upstream branch may advance and it may not be the best idea to keep
793 rebasing on top of the upstream but to keep the base commit as-is. As
794 the base commit is unchanged this option implies
<code>--reapply-cherry-picks
</code>
795 to avoid losing commits.
</p>
797 <div class=
"paragraph">
798 <p>Although both this option and
<code>--fork-point
</code> find the merge base between
799 <em><upstream
></em> and
<em><branch
></em>, this option uses the merge base as the
<em>starting
800 point
</em> on which new commits will be created, whereas
<code>--fork-point
</code> uses
801 the merge base to determine the
<em>set of commits
</em> which will be rebased.
</p>
803 <div class=
"paragraph">
804 <p>See also INCOMPATIBLE OPTIONS below.
</p>
807 <dt class=
"hdlist1"><upstream
></dt>
809 <p>Upstream branch to compare against. May be any valid commit,
810 not just an existing branch name. Defaults to the configured
811 upstream for the current branch.
</p>
813 <dt class=
"hdlist1"><branch
></dt>
815 <p>Working branch; defaults to
<code>HEAD
</code>.
</p>
817 <dt class=
"hdlist1">--apply
</dt>
819 <p>Use applying strategies to rebase (calling
<code>git-am
</code>
820 internally). This option may become a no-op in the future
821 once the merge backend handles everything the apply one does.
</p>
822 <div class=
"paragraph">
823 <p>See also INCOMPATIBLE OPTIONS below.
</p>
826 <dt class=
"hdlist1">--empty=(drop|keep|stop)
</dt>
828 <p>How to handle commits that are not empty to start and are not
829 clean cherry-picks of any upstream commit, but which become
830 empty after rebasing (because they contain a subset of already
831 upstream changes):
</p>
832 <div class=
"openblock">
833 <div class=
"content">
836 <dt class=
"hdlist1"><code>drop
</code></dt>
838 <p>The commit will be dropped. This is the default behavior.
</p>
840 <dt class=
"hdlist1"><code>keep
</code></dt>
842 <p>The commit will be kept. This option is implied when
<code>--exec
</code> is
843 specified unless
<code>-i
</code>/
<code>--interactive
</code> is also specified.
</p>
845 <dt class=
"hdlist1"><code>stop
</code></dt>
846 <dt class=
"hdlist1"><code>ask
</code></dt>
848 <p>The rebase will halt when the commit is applied, allowing you to
849 choose whether to drop it, edit files more, or just commit the empty
850 changes. This option is implied when
<code>-i
</code>/
<code>--interactive
</code> is
851 specified.
<code>ask
</code> is a deprecated synonym of
<code>stop
</code>.
</p>
857 <div class=
"paragraph">
858 <p>Note that commits which start empty are kept (unless
<code>--no-keep-empty
</code>
859 is specified), and commits which are clean cherry-picks (as determined
860 by
<code>git
</code> <code>log
</code> <code>--cherry-mark
</code> ...) are detected and dropped as a
861 preliminary step (unless
<code>--reapply-cherry-picks
</code> or
<code>--keep-base
</code> is
864 <div class=
"paragraph">
865 <p>See also INCOMPATIBLE OPTIONS below.
</p>
868 <dt class=
"hdlist1">--no-keep-empty
</dt>
869 <dt class=
"hdlist1">--keep-empty
</dt>
871 <p>Do not keep commits that start empty before the rebase
872 (i.e. that do not change anything from its parent) in the
873 result. The default is to keep commits which start empty,
874 since creating such commits requires passing the
<code>--allow-empty
</code>
875 override flag to
<code>git
</code> <code>commit
</code>, signifying that a user is very
876 intentionally creating such a commit and thus wants to keep
878 <div class=
"paragraph">
879 <p>Usage of this flag will probably be rare, since you can get rid of
880 commits that start empty by just firing up an interactive rebase and
881 removing the lines corresponding to the commits you don
’t want. This
882 flag exists as a convenient shortcut, such as for cases where external
883 tools generate many empty commits and you want them all removed.
</p>
885 <div class=
"paragraph">
886 <p>For commits which do not start empty but become empty after rebasing,
887 see the
<code>--empty
</code> flag.
</p>
889 <div class=
"paragraph">
890 <p>See also INCOMPATIBLE OPTIONS below.
</p>
893 <dt class=
"hdlist1">--reapply-cherry-picks
</dt>
894 <dt class=
"hdlist1">--no-reapply-cherry-picks
</dt>
896 <p>Reapply all clean cherry-picks of any upstream commit instead
897 of preemptively dropping them. (If these commits then become
898 empty after rebasing, because they contain a subset of already
899 upstream changes, the behavior towards them is controlled by
900 the
<code>--empty
</code> flag.)
</p>
901 <div class=
"paragraph">
902 <p>In the absence of
<code>--keep-base
</code> (or if
<code>--no-reapply-cherry-picks
</code> is
903 given), these commits will be automatically dropped. Because this
904 necessitates reading all upstream commits, this can be expensive in
905 repositories with a large number of upstream commits that need to be
906 read. When using the
<em>merge
</em> backend, warnings will be issued for each
907 dropped commit (unless
<code>--quiet
</code> is given). Advice will also be issued
908 unless
<code>advice.skippedCherryPicks
</code> is set to false (see
909 <a href=
"git-config.html">git-config(
1)
</a>).
</p>
911 <div class=
"paragraph">
912 <p><code>--reapply-cherry-picks
</code> allows rebase to forgo reading all upstream
913 commits, potentially improving performance.
</p>
915 <div class=
"paragraph">
916 <p>See also INCOMPATIBLE OPTIONS below.
</p>
919 <dt class=
"hdlist1">--allow-empty-message
</dt>
921 <p>No-op. Rebasing commits with an empty message used to fail
922 and this option would override that behavior, allowing commits
923 with empty messages to be rebased. Now commits with an empty
924 message do not cause rebasing to halt.
</p>
925 <div class=
"paragraph">
926 <p>See also INCOMPATIBLE OPTIONS below.
</p>
929 <dt class=
"hdlist1">-m
</dt>
930 <dt class=
"hdlist1">--merge
</dt>
932 <p>Using merging strategies to rebase (default).
</p>
933 <div class=
"paragraph">
934 <p>Note that a rebase merge works by replaying each commit from the working
935 branch on top of the
<em><upstream
></em> branch. Because of this, when a merge
936 conflict happens, the side reported as
<em>ours
</em> is the so-far rebased
937 series, starting with
<em><upstream
></em>, and
<em>theirs
</em> is the working branch.
938 In other words, the sides are swapped.
</p>
940 <div class=
"paragraph">
941 <p>See also INCOMPATIBLE OPTIONS below.
</p>
944 <dt class=
"hdlist1">-s
<strategy
></dt>
945 <dt class=
"hdlist1">--strategy=
<strategy
></dt>
947 <p>Use the given merge strategy, instead of the default
<code>ort
</code>.
948 This implies
<code>--merge
</code>.
</p>
949 <div class=
"paragraph">
950 <p>Because
<code>git
</code> <code>rebase
</code> replays each commit from the working branch
951 on top of the
<em><upstream
></em> branch using the given strategy, using
952 the
<code>ours
</code> strategy simply empties all patches from the
<em><branch
></em>,
953 which makes little sense.
</p>
955 <div class=
"paragraph">
956 <p>See also INCOMPATIBLE OPTIONS below.
</p>
959 <dt class=
"hdlist1">-X
<strategy-option
></dt>
960 <dt class=
"hdlist1">--strategy-option=
<strategy-option
></dt>
962 <p>Pass the
<strategy-option
> through to the merge strategy.
963 This implies
<code>--merge
</code> and, if no strategy has been
964 specified,
<code>-s
</code> <code>ort
</code>. Note the reversal of
<em>ours
</em> and
965 <em>theirs
</em> as noted above for the
<code>-m
</code> option.
</p>
966 <div class=
"paragraph">
967 <p>See also INCOMPATIBLE OPTIONS below.
</p>
970 <dt class=
"hdlist1">--rerere-autoupdate
</dt>
971 <dt class=
"hdlist1">--no-rerere-autoupdate
</dt>
973 <p>After the rerere mechanism reuses a recorded resolution on
974 the current conflict to update the files in the working
975 tree, allow it to also update the index with the result of
976 resolution.
<code>--no-rerere-autoupdate
</code> is a good way to
977 double-check what
<code>rerere
</code> did and catch potential
978 mismerges, before committing the result to the index with a
979 separate
<code>git
</code> <code>add
</code>.
</p>
981 <dt class=
"hdlist1">-S[
<keyid
>]
</dt>
982 <dt class=
"hdlist1">--gpg-sign[=
<keyid
>]
</dt>
983 <dt class=
"hdlist1">--no-gpg-sign
</dt>
985 <p>GPG-sign commits. The
<code>keyid
</code> argument is optional and
986 defaults to the committer identity; if specified, it must be
987 stuck to the option without a space.
<code>--no-gpg-sign
</code> is useful to
988 countermand both
<code>commit.gpgSign
</code> configuration variable, and
989 earlier
<code>--gpg-sign
</code>.
</p>
991 <dt class=
"hdlist1">-q
</dt>
992 <dt class=
"hdlist1">--quiet
</dt>
994 <p>Be quiet. Implies
<code>--no-stat
</code>.
</p>
996 <dt class=
"hdlist1">-v
</dt>
997 <dt class=
"hdlist1">--verbose
</dt>
999 <p>Be verbose. Implies
<code>--stat
</code>.
</p>
1001 <dt class=
"hdlist1">--stat
</dt>
1003 <p>Show a diffstat of what changed upstream since the last rebase. The
1004 diffstat is also controlled by the configuration option rebase.stat.
</p>
1006 <dt class=
"hdlist1">-n
</dt>
1007 <dt class=
"hdlist1">--no-stat
</dt>
1009 <p>Do not show a diffstat as part of the rebase process.
</p>
1011 <dt class=
"hdlist1">--no-verify
</dt>
1013 <p>This option bypasses the pre-rebase hook. See also
<a href=
"githooks.html">githooks(
5)
</a>.
</p>
1015 <dt class=
"hdlist1">--verify
</dt>
1017 <p>Allows the pre-rebase hook to run, which is the default. This option can
1018 be used to override
<code>--no-verify
</code>. See also
<a href=
"githooks.html">githooks(
5)
</a>.
</p>
1020 <dt class=
"hdlist1">-C
<n
></dt>
1022 <p>Ensure at least
<em><n
></em> lines of surrounding context match before
1023 and after each change. When fewer lines of surrounding
1024 context exist they all must match. By default no context is
1025 ever ignored. Implies
<code>--apply
</code>.
</p>
1026 <div class=
"paragraph">
1027 <p>See also INCOMPATIBLE OPTIONS below.
</p>
1030 <dt class=
"hdlist1">--no-ff
</dt>
1031 <dt class=
"hdlist1">--force-rebase
</dt>
1032 <dt class=
"hdlist1">-f
</dt>
1034 <p>Individually replay all rebased commits instead of fast-forwarding
1035 over the unchanged ones. This ensures that the entire history of
1036 the rebased branch is composed of new commits.
</p>
1037 <div class=
"paragraph">
1038 <p>You may find this helpful after reverting a topic branch merge, as this option
1039 recreates the topic branch with fresh commits so it can be remerged
1040 successfully without needing to
"revert the reversion" (see the
1041 <a href=
"howto/revert-a-faulty-merge.html">revert-a-faulty-merge How-To
</a> for
1045 <dt class=
"hdlist1">--fork-point
</dt>
1046 <dt class=
"hdlist1">--no-fork-point
</dt>
1048 <p>Use reflog to find a better common ancestor between
<em><upstream
></em>
1049 and
<em><branch
></em> when calculating which commits have been
1050 introduced by
<em><branch
></em>.
</p>
1051 <div class=
"paragraph">
1052 <p>When
<code>--fork-point
</code> is active,
<em>fork_point
</em> will be used instead of
1053 <em><upstream
></em> to calculate the set of commits to rebase, where
1054 <em>fork_point
</em> is the result of
<code>git
</code> <code>merge-base
</code> <code>--fork-point
</code> <em><upstream
></em>
1055 <em><branch
></em> command (see
<a href=
"git-merge-base.html">git-merge-base(
1)
</a>). If
<em>fork_point
</em>
1056 ends up being empty, the
<em><upstream
></em> will be used as a fallback.
</p>
1058 <div class=
"paragraph">
1059 <p>If
<em><upstream
></em> or
<code>--keep-base
</code> is given on the command line, then
1060 the default is
<code>--no-fork-point
</code>, otherwise the default is
1061 <code>--fork-point
</code>. See also
<code>rebase.forkpoint
</code> in
<a href=
"git-config.html">git-config(
1)
</a>.
</p>
1063 <div class=
"paragraph">
1064 <p>If your branch was based on
<em><upstream
></em> but
<em><upstream
></em> was rewound and
1065 your branch contains commits which were dropped, this option can be used
1066 with
<code>--keep-base
</code> in order to drop those commits from your branch.
</p>
1068 <div class=
"paragraph">
1069 <p>See also INCOMPATIBLE OPTIONS below.
</p>
1072 <dt class=
"hdlist1">--ignore-whitespace
</dt>
1074 <p>Ignore whitespace differences when trying to reconcile
1075 differences. Currently, each backend implements an approximation of
1079 <dt class=
"hdlist1">apply backend
</dt>
1081 <p>When applying a patch, ignore changes in whitespace in context
1082 lines. Unfortunately, this means that if the
"old" lines being
1083 replaced by the patch differ only in whitespace from the existing
1084 file, you will get a merge conflict instead of a successful patch
1087 <dt class=
"hdlist1">merge backend
</dt>
1089 <p>Treat lines with only whitespace changes as unchanged when merging.
1090 Unfortunately, this means that any patch hunks that were intended
1091 to modify whitespace and nothing else will be dropped, even if the
1092 other side had no changes that conflicted.
</p>
1097 <dt class=
"hdlist1">--whitespace=
<option
></dt>
1099 <p>This flag is passed to the
<code>git
</code> <code>apply
</code> program
1100 (see
<a href=
"git-apply.html">git-apply(
1)
</a>) that applies the patch.
1101 Implies
<code>--apply
</code>.
</p>
1102 <div class=
"paragraph">
1103 <p>See also INCOMPATIBLE OPTIONS below.
</p>
1106 <dt class=
"hdlist1">--committer-date-is-author-date
</dt>
1108 <p>Instead of using the current time as the committer date, use
1109 the author date of the commit being rebased as the committer
1110 date. This option implies
<code>--force-rebase
</code>.
</p>
1112 <dt class=
"hdlist1">--ignore-date
</dt>
1113 <dt class=
"hdlist1">--reset-author-date
</dt>
1115 <p>Instead of using the author date of the original commit, use
1116 the current time as the author date of the rebased commit. This
1117 option implies
<code>--force-rebase
</code>.
</p>
1118 <div class=
"paragraph">
1119 <p>See also INCOMPATIBLE OPTIONS below.
</p>
1122 <dt class=
"hdlist1">--signoff
</dt>
1124 <p>Add a
<code>Signed-off-by
</code> trailer to all the rebased commits. Note
1125 that if
<code>--interactive
</code> is given then only commits marked to be
1126 picked, edited or reworded will have the trailer added.
</p>
1127 <div class=
"paragraph">
1128 <p>See also INCOMPATIBLE OPTIONS below.
</p>
1131 <dt class=
"hdlist1">-i
</dt>
1132 <dt class=
"hdlist1">--interactive
</dt>
1134 <p>Make a list of the commits which are about to be rebased. Let the
1135 user edit that list before rebasing. This mode can also be used to
1136 split commits (see SPLITTING COMMITS below).
</p>
1137 <div class=
"paragraph">
1138 <p>The commit list format can be changed by setting the configuration option
1139 rebase.instructionFormat. A customized instruction format will automatically
1140 have the commit hash prepended to the format.
</p>
1142 <div class=
"paragraph">
1143 <p>See also INCOMPATIBLE OPTIONS below.
</p>
1146 <dt class=
"hdlist1">-r
</dt>
1147 <dt class=
"hdlist1">--rebase-merges[=(rebase-cousins|no-rebase-cousins)]
</dt>
1148 <dt class=
"hdlist1">--no-rebase-merges
</dt>
1150 <p>By default, a rebase will simply drop merge commits from the todo
1151 list, and put the rebased commits into a single, linear branch.
1152 With
<code>--rebase-merges
</code>, the rebase will instead try to preserve
1153 the branching structure within the commits that are to be rebased,
1154 by recreating the merge commits. Any resolved merge conflicts or
1155 manual amendments in these merge commits will have to be
1156 resolved/re-applied manually.
<code>--no-rebase-merges
</code> can be used to
1157 countermand both the
<code>rebase.rebaseMerges
</code> config option and a previous
1158 <code>--rebase-merges
</code>.
</p>
1159 <div class=
"paragraph">
1160 <p>When rebasing merges, there are two modes:
<code>rebase-cousins
</code> and
1161 <code>no-rebase-cousins
</code>. If the mode is not specified, it defaults to
1162 <code>no-rebase-cousins
</code>. In
<code>no-rebase-cousins
</code> mode, commits which do not have
1163 <em><upstream
></em> as direct ancestor will keep their original branch point, i.e.
1164 commits that would be excluded by
<a href=
"git-log.html">git-log(
1)
</a>'s
<code>--ancestry-path
</code>
1165 option will keep their original ancestry by default. In
<code>rebase-cousins
</code> mode,
1166 such commits are instead rebased onto
<em><upstream
></em> (or
<em><onto
></em>, if
1169 <div class=
"paragraph">
1170 <p>It is currently only possible to recreate the merge commits using the
1171 <code>ort
</code> merge strategy; different merge strategies can be used only via
1172 explicit
<code>exec
</code> <code>git
</code> <code>merge
</code> <code>-s
</code> <em><strategy
></em> [...] commands.
</p>
1174 <div class=
"paragraph">
1175 <p>See also REBASING MERGES and INCOMPATIBLE OPTIONS below.
</p>
1178 <dt class=
"hdlist1">-x
<cmd
></dt>
1179 <dt class=
"hdlist1">--exec
<cmd
></dt>
1181 <p>Append
"exec <cmd>" after each line creating a commit in the
1182 final history.
<em><cmd
></em> will be interpreted as one or more shell
1183 commands. Any command that fails will interrupt the rebase,
1184 with exit code
1.
</p>
1185 <div class=
"paragraph">
1186 <p>You may execute several commands by either using one instance of
<code>--exec
</code>
1187 with several commands:
</p>
1189 <div class=
"literalblock">
1190 <div class=
"content">
1191 <pre>git rebase -i --exec
"cmd1 && cmd2 && ..."</pre>
1194 <div class=
"paragraph">
1195 <p>or by giving more than one
<code>--exec
</code>:
</p>
1197 <div class=
"literalblock">
1198 <div class=
"content">
1199 <pre>git rebase -i --exec
"cmd1" --exec
"cmd2" --exec ...
</pre>
1202 <div class=
"paragraph">
1203 <p>If
<code>--autosquash
</code> is used,
<code>exec
</code> lines will not be appended for
1204 the intermediate commits, and will only appear at the end of each
1205 squash/fixup series.
</p>
1207 <div class=
"paragraph">
1208 <p>This uses the
<code>--interactive
</code> machinery internally, but it can be run
1209 without an explicit
<code>--interactive
</code>.
</p>
1211 <div class=
"paragraph">
1212 <p>See also INCOMPATIBLE OPTIONS below.
</p>
1215 <dt class=
"hdlist1">--root
</dt>
1217 <p>Rebase all commits reachable from
<em><branch
></em>, instead of
1218 limiting them with an
<em><upstream
></em>. This allows you to rebase
1219 the root commit(s) on a branch.
</p>
1220 <div class=
"paragraph">
1221 <p>See also INCOMPATIBLE OPTIONS below.
</p>
1224 <dt class=
"hdlist1">--autosquash
</dt>
1225 <dt class=
"hdlist1">--no-autosquash
</dt>
1227 <p>Automatically squash commits with specially formatted messages into
1228 previous commits being rebased. If a commit message starts with
1229 "squash! ",
"fixup! " or
"amend! ", the remainder of the subject line
1230 is taken as a commit specifier, which matches a previous commit if it
1231 matches the subject line or the hash of that commit. If no commit
1232 matches fully, matches of the specifier with the start of commit
1233 subjects are considered.
</p>
1234 <div class=
"paragraph">
1235 <p>In the rebase todo list, the actions of squash, fixup and amend commits are
1236 changed from
<code>pick
</code> to
<code>squash
</code>,
<code>fixup
</code> or
<code>fixup
</code> <code>-C
</code>, respectively, and they
1237 are moved right after the commit they modify. The
<code>--interactive
</code> option can
1238 be used to review and edit the todo list before proceeding.
</p>
1240 <div class=
"paragraph">
1241 <p>The recommended way to create commits with squash markers is by using the
1242 <code>--squash
</code>,
<code>--fixup
</code>,
<code>--fixup=amend:
</code> or
<code>--fixup=reword:
</code> options of
1243 <a href=
"git-commit.html">git-commit(
1)
</a>, which take the target commit as an argument and
1244 automatically fill in the subject line of the new commit from that.
</p>
1246 <div class=
"paragraph">
1247 <p>Setting configuration variable
<code>rebase.autoSquash
</code> to true enables
1248 auto-squashing by default for interactive rebase. The
<code>--no-autosquash
</code>
1249 option can be used to override that setting.
</p>
1251 <div class=
"paragraph">
1252 <p>See also INCOMPATIBLE OPTIONS below.
</p>
1255 <dt class=
"hdlist1">--autostash
</dt>
1256 <dt class=
"hdlist1">--no-autostash
</dt>
1258 <p>Automatically create a temporary stash entry before the operation
1259 begins, and apply it after the operation ends. This means
1260 that you can run rebase on a dirty worktree. However, use
1261 with care: the final stash application after a successful
1262 rebase might result in non-trivial conflicts.
</p>
1264 <dt class=
"hdlist1">--reschedule-failed-exec
</dt>
1265 <dt class=
"hdlist1">--no-reschedule-failed-exec
</dt>
1267 <p>Automatically reschedule
<code>exec
</code> commands that failed. This only makes
1268 sense in interactive mode (or when an
<code>--exec
</code> option was provided).
</p>
1269 <div class=
"paragraph">
1270 <p>This option applies once a rebase is started. It is preserved for the whole
1271 rebase based on, in order, the command line option provided to the initial
<code>git
</code>
1272 <code>rebase
</code>, the
<code>rebase.rescheduleFailedExec
</code> configuration (see
1273 <a href=
"git-config.html">git-config(
1)
</a> or
"CONFIGURATION" below), or it defaults to false.
</p>
1275 <div class=
"paragraph">
1276 <p>Recording this option for the whole rebase is a convenience feature. Otherwise
1277 an explicit
<code>--no-reschedule-failed-exec
</code> at the start would be overridden by
1278 the presence of a
<code>rebase.rescheduleFailedExec=true
</code> configuration when
<code>git
</code>
1279 <code>rebase
</code> <code>--continue
</code> is invoked. Currently, you cannot pass
1280 <code>--
</code>[
<code>no-
</code>]
<code>reschedule-failed-exec
</code> to
<code>git
</code> <code>rebase
</code> <code>--continue
</code>.
</p>
1283 <dt class=
"hdlist1">--update-refs
</dt>
1284 <dt class=
"hdlist1">--no-update-refs
</dt>
1286 <p>Automatically force-update any branches that point to commits that
1287 are being rebased. Any branches that are checked out in a worktree
1288 are not updated in this way.
</p>
1289 <div class=
"paragraph">
1290 <p>If the configuration variable
<code>rebase.updateRefs
</code> is set, then this option
1291 can be used to override and disable this setting.
</p>
1293 <div class=
"paragraph">
1294 <p>See also INCOMPATIBLE OPTIONS below.
</p>
1302 <h2 id=
"_incompatible_options">INCOMPATIBLE OPTIONS
</h2>
1303 <div class=
"sectionbody">
1304 <div class=
"paragraph">
1305 <p>The following options:
</p>
1320 <div class=
"paragraph">
1321 <p>are incompatible with the following options:
</p>
1332 <p>--strategy-option
</p>
1338 <p>--rebase-merges
</p>
1341 <p>--interactive
</p>
1347 <p>--no-keep-empty
</p>
1353 <p>--[no-]reapply-cherry-picks when used without --keep-base
</p>
1356 <p>--update-refs
</p>
1359 <p>--root when used without --onto
</p>
1363 <div class=
"paragraph">
1364 <p>In addition, the following pairs of options are incompatible:
</p>
1369 <p>--keep-base and --onto
</p>
1372 <p>--keep-base and --root
</p>
1375 <p>--fork-point and --root
</p>
1382 <h2 id=
"_behavioral_differences">BEHAVIORAL DIFFERENCES
</h2>
1383 <div class=
"sectionbody">
1384 <div class=
"paragraph">
1385 <p><code>git
</code> <code>rebase
</code> has two primary backends:
<em>apply
</em> and
<em>merge
</em>. (The
<em>apply
</em>
1386 backend used to be known as the
<em>am
</em> backend, but the name led to
1387 confusion as it looks like a verb instead of a noun. Also, the
<em>merge
</em>
1388 backend used to be known as the interactive backend, but it is now
1389 used for non-interactive cases as well. Both were renamed based on
1390 lower-level functionality that underpinned each.) There are some
1391 subtle differences in how these two backends behave:
</p>
1394 <h3 id=
"_empty_commits">Empty commits
</h3>
1395 <div class=
"paragraph">
1396 <p>The
<em>apply
</em> backend unfortunately drops intentionally empty commits, i.e.
1397 commits that started empty, though these are rare in practice. It
1398 also drops commits that become empty and has no option for controlling
1401 <div class=
"paragraph">
1402 <p>The
<em>merge
</em> backend keeps intentionally empty commits by default (though
1403 with
<code>-i
</code> they are marked as empty in the todo list editor, or they can
1404 be dropped automatically with
<code>--no-keep-empty
</code>).
</p>
1406 <div class=
"paragraph">
1407 <p>Similar to the apply backend, by default the merge backend drops
1408 commits that become empty unless
<code>-i
</code>/
<code>--interactive
</code> is specified (in
1409 which case it stops and asks the user what to do). The merge backend
1410 also has an
<code>--empty=
</code>(
<code>drop
</code>|
<code>keep
</code>|
<code>stop
</code>) option for changing the behavior
1411 of handling commits that become empty.
</p>
1415 <h3 id=
"_directory_rename_detection">Directory rename detection
</h3>
1416 <div class=
"paragraph">
1417 <p>Due to the lack of accurate tree information (arising from
1418 constructing fake ancestors with the limited information available in
1419 patches), directory rename detection is disabled in the
<em>apply
</em> backend.
1420 Disabled directory rename detection means that if one side of history
1421 renames a directory and the other adds new files to the old directory,
1422 then the new files will be left behind in the old directory without
1423 any warning at the time of rebasing that you may want to move these
1424 files into the new directory.
</p>
1426 <div class=
"paragraph">
1427 <p>Directory rename detection works with the
<em>merge
</em> backend to provide you
1428 warnings in such cases.
</p>
1432 <h3 id=
"_context">Context
</h3>
1433 <div class=
"paragraph">
1434 <p>The
<em>apply
</em> backend works by creating a sequence of patches (by calling
1435 <code>format-patch
</code> internally), and then applying the patches in sequence
1436 (calling
<code>am
</code> internally). Patches are composed of multiple hunks,
1437 each with line numbers, a context region, and the actual changes. The
1438 line numbers have to be taken with some offset, since the other side
1439 will likely have inserted or deleted lines earlier in the file. The
1440 context region is meant to help find how to adjust the line numbers in
1441 order to apply the changes to the right lines. However, if multiple
1442 areas of the code have the same surrounding lines of context, the
1443 wrong one can be picked. There are real-world cases where this has
1444 caused commits to be reapplied incorrectly with no conflicts reported.
1445 Setting
<code>diff.context
</code> to a larger value may prevent such types of
1446 problems, but increases the chance of spurious conflicts (since it
1447 will require more lines of matching context to apply).
</p>
1449 <div class=
"paragraph">
1450 <p>The
<em>merge
</em> backend works with a full copy of each relevant file,
1451 insulating it from these types of problems.
</p>
1455 <h3 id=
"_labelling_of_conflicts_markers">Labelling of conflicts markers
</h3>
1456 <div class=
"paragraph">
1457 <p>When there are content conflicts, the merge machinery tries to
1458 annotate each side
’s conflict markers with the commits where the
1459 content came from. Since the
<em>apply
</em> backend drops the original
1460 information about the rebased commits and their parents (and instead
1461 generates new fake commits based off limited information in the
1462 generated patches), those commits cannot be identified; instead it has
1463 to fall back to a commit summary. Also, when
<code>merge.conflictStyle
</code> is
1464 set to
<code>diff3
</code> or
<code>zdiff3
</code>, the
<em>apply
</em> backend will use
"constructed merge
1465 base" to label the content from the merge base, and thus provide no
1466 information about the merge base commit whatsoever.
</p>
1468 <div class=
"paragraph">
1469 <p>The
<em>merge
</em> backend works with the full commits on both sides of history
1470 and thus has no such limitations.
</p>
1474 <h3 id=
"_hooks">Hooks
</h3>
1475 <div class=
"paragraph">
1476 <p>The
<em>apply
</em> backend has not traditionally called the post-commit hook,
1477 while the
<em>merge
</em> backend has. Both have called the post-checkout hook,
1478 though the
<em>merge
</em> backend has squelched its output. Further, both
1479 backends only call the post-checkout hook with the starting point
1480 commit of the rebase, not the intermediate commits nor the final
1481 commit. In each case, the calling of these hooks was by accident of
1482 implementation rather than by design (both backends were originally
1483 implemented as shell scripts and happened to invoke other commands
1484 like
<code>git
</code> <code>checkout
</code> or
<code>git
</code> <code>commit
</code> that would call the hooks). Both
1485 backends should have the same behavior, though it is not entirely
1486 clear which, if any, is correct. We will likely make rebase stop
1487 calling either of these hooks in the future.
</p>
1491 <h3 id=
"_interruptability">Interruptability
</h3>
1492 <div class=
"paragraph">
1493 <p>The
<em>apply
</em> backend has safety problems with an ill-timed interrupt; if
1494 the user presses Ctrl-C at the wrong time to try to abort the rebase,
1495 the rebase can enter a state where it cannot be aborted with a
1496 subsequent
<code>git
</code> <code>rebase
</code> <code>--abort
</code>. The
<em>merge
</em> backend does not appear to
1497 suffer from the same shortcoming. (See
1498 <a href=
"https://lore.kernel.org/git/20200207132152.GC2868@szeder.dev/" class=
"bare">https://lore.kernel.org/git/
20200207132152.GC2868@szeder.dev/
</a> for
1503 <h3 id=
"_commit_rewording">Commit Rewording
</h3>
1504 <div class=
"paragraph">
1505 <p>When a conflict occurs while rebasing, rebase stops and asks the user
1506 to resolve. Since the user may need to make notable changes while
1507 resolving conflicts, after conflicts are resolved and the user has run
1508 <code>git
</code> <code>rebase
</code> <code>--continue
</code>, the rebase should open an editor and ask the
1509 user to update the commit message. The
<em>merge
</em> backend does this, while
1510 the
<em>apply
</em> backend blindly applies the original commit message.
</p>
1514 <h3 id=
"_miscellaneous_differences">Miscellaneous differences
</h3>
1515 <div class=
"paragraph">
1516 <p>There are a few more behavioral differences that most folks would
1517 probably consider inconsequential but which are mentioned for
1523 <p>Reflog: The two backends will use different wording when describing
1524 the changes made in the reflog, though both will make use of the
1528 <p>Progress, informational, and error messages: The two backends
1529 provide slightly different progress and informational messages.
1530 Also, the apply backend writes error messages (such as
"Your files
1531 would be overwritten…​") to stdout, while the merge backend writes
1535 <p>State directories: The two backends keep their state in different
1536 directories under .
<code>git/
</code></p>
1544 <h2 id=
"_merge_strategies">MERGE STRATEGIES
</h2>
1545 <div class=
"sectionbody">
1546 <div class=
"paragraph">
1547 <p>The merge mechanism (
<code>git
</code> <code>merge
</code> and
<code>git
</code> <code>pull
</code> commands) allows the
1548 backend
<em>merge strategies
</em> to be chosen with
<code>-s
</code> option. Some strategies
1549 can also take their own options, which can be passed by giving
<code>-X
</code><em><option
></em>
1550 arguments to
<code>git
</code> <code>merge
</code> and/or
<code>git
</code> <code>pull
</code>.
</p>
1554 <dt class=
"hdlist1">ort
</dt>
1556 <p>This is the default merge strategy when pulling or merging one
1557 branch. This strategy can only resolve two heads using a
1558 3-way merge algorithm. When there is more than one common
1559 ancestor that can be used for
3-way merge, it creates a merged
1560 tree of the common ancestors and uses that as the reference
1561 tree for the
3-way merge. This has been reported to result in
1562 fewer merge conflicts without causing mismerges by tests done
1563 on actual merge commits taken from Linux
2.6 kernel
1564 development history. Additionally this strategy can detect
1565 and handle merges involving renames. It does not make use of
1566 detected copies. The name for this algorithm is an acronym
1567 (
"Ostensibly Recursive’s Twin") and came from the fact that it
1568 was written as a replacement for the previous default
1569 algorithm,
<code>recursive
</code>.
</p>
1570 <div class=
"paragraph">
1571 <p>The
<em>ort
</em> strategy can take the following options:
</p>
1575 <dt class=
"hdlist1">ours
</dt>
1577 <p>This option forces conflicting hunks to be auto-resolved cleanly by
1578 favoring
<em>our
</em> version. Changes from the other tree that do not
1579 conflict with our side are reflected in the merge result.
1580 For a binary file, the entire contents are taken from our side.
</p>
1581 <div class=
"paragraph">
1582 <p>This should not be confused with the
<em>ours
</em> merge strategy, which does not
1583 even look at what the other tree contains at all. It discards everything
1584 the other tree did, declaring
<em>our
</em> history contains all that happened in it.
</p>
1587 <dt class=
"hdlist1">theirs
</dt>
1589 <p>This is the opposite of
<em>ours
</em>; note that, unlike
<em>ours
</em>, there is
1590 no
<em>theirs
</em> merge strategy to confuse this merge option with.
</p>
1592 <dt class=
"hdlist1">ignore-space-change
</dt>
1593 <dt class=
"hdlist1">ignore-all-space
</dt>
1594 <dt class=
"hdlist1">ignore-space-at-eol
</dt>
1595 <dt class=
"hdlist1">ignore-cr-at-eol
</dt>
1597 <p>Treats lines with the indicated type of whitespace change as
1598 unchanged for the sake of a three-way merge. Whitespace
1599 changes mixed with other changes to a line are not ignored.
1600 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <code>-b
</code>,
<code>-w
</code>,
1601 <code>--ignore-space-at-eol
</code>, and
<code>--ignore-cr-at-eol
</code>.
</p>
1605 <p>If
<em>their
</em> version only introduces whitespace changes to a line,
1606 <em>our
</em> version is used;
</p>
1609 <p>If
<em>our
</em> version introduces whitespace changes but
<em>their
</em>
1610 version includes a substantial change,
<em>their
</em> version is used;
</p>
1613 <p>Otherwise, the merge proceeds in the usual way.
</p>
1618 <dt class=
"hdlist1">renormalize
</dt>
1620 <p>This runs a virtual check-out and check-in of all three stages
1621 of a file when resolving a three-way merge. This option is
1622 meant to be used when merging branches with different clean
1623 filters or end-of-line normalization rules. See
"Merging
1624 branches with differing checkin/checkout attributes" in
1625 <a href=
"gitattributes.html">gitattributes(
5)
</a> for details.
</p>
1627 <dt class=
"hdlist1">no-renormalize
</dt>
1629 <p>Disables the
<code>renormalize
</code> option. This overrides the
1630 <code>merge.renormalize
</code> configuration variable.
</p>
1632 <dt class=
"hdlist1">find-renames[=
<n
>]
</dt>
1634 <p>Turn on rename detection, optionally setting the similarity
1635 threshold. This is the default. This overrides the
1636 <em>merge.renames
</em> configuration variable.
1637 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <code>--find-renames
</code>.
</p>
1639 <dt class=
"hdlist1">rename-threshold=
<n
></dt>
1641 <p>Deprecated synonym for
<code>find-renames=
</code><em><n
></em>.
</p>
1643 <dt class=
"hdlist1">subtree[=
<path
>]
</dt>
1645 <p>This option is a more advanced form of
<em>subtree
</em> strategy, where
1646 the strategy makes a guess on how two trees must be shifted to
1647 match with each other when merging. Instead, the specified path
1648 is prefixed (or stripped from the beginning) to make the shape of
1649 two trees to match.
</p>
1654 <dt class=
"hdlist1">recursive
</dt>
1656 <p>This can only resolve two heads using a
3-way merge
1657 algorithm. When there is more than one common
1658 ancestor that can be used for
3-way merge, it creates a
1659 merged tree of the common ancestors and uses that as
1660 the reference tree for the
3-way merge. This has been
1661 reported to result in fewer merge conflicts without
1662 causing mismerges by tests done on actual merge commits
1663 taken from Linux
2.6 kernel development history.
1664 Additionally this can detect and handle merges involving
1665 renames. It does not make use of detected copies. This was
1666 the default strategy for resolving two heads from Git v0.99
.9k
1668 <div class=
"paragraph">
1669 <p>The
<em>recursive
</em> strategy takes the same options as
<em>ort
</em>. However,
1670 there are three additional options that
<em>ort
</em> ignores (not documented
1671 above) that are potentially useful with the
<em>recursive
</em> strategy:
</p>
1675 <dt class=
"hdlist1">patience
</dt>
1677 <p>Deprecated synonym for
<code>diff-algorithm=patience
</code>.
</p>
1679 <dt class=
"hdlist1">diff-algorithm=[patience|minimal|histogram|myers]
</dt>
1681 <p>Use a different diff algorithm while merging, which can help
1682 avoid mismerges that occur due to unimportant matching lines
1683 (such as braces from distinct functions). See also
1684 <a href=
"git-diff.html">git-diff(
1)
</a> <code>--diff-algorithm
</code>. Note that
<code>ort
</code>
1685 specifically uses
<code>diff-algorithm=histogram
</code>, while
<code>recursive
</code>
1686 defaults to the
<code>diff.algorithm
</code> config setting.
</p>
1688 <dt class=
"hdlist1">no-renames
</dt>
1690 <p>Turn off rename detection. This overrides the
<code>merge.renames
</code>
1691 configuration variable.
1692 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <code>--no-renames
</code>.
</p>
1697 <dt class=
"hdlist1">resolve
</dt>
1699 <p>This can only resolve two heads (i.e. the current branch
1700 and another branch you pulled from) using a
3-way merge
1701 algorithm. It tries to carefully detect criss-cross
1702 merge ambiguities. It does not handle renames.
</p>
1704 <dt class=
"hdlist1">octopus
</dt>
1706 <p>This resolves cases with more than two heads, but refuses to do
1707 a complex merge that needs manual resolution. It is
1708 primarily meant to be used for bundling topic branch
1709 heads together. This is the default merge strategy when
1710 pulling or merging more than one branch.
</p>
1712 <dt class=
"hdlist1">ours
</dt>
1714 <p>This resolves any number of heads, but the resulting tree of the
1715 merge is always that of the current branch head, effectively
1716 ignoring all changes from all other branches. It is meant to
1717 be used to supersede old development history of side
1718 branches. Note that this is different from the -Xours option to
1719 the
<em>recursive
</em> merge strategy.
</p>
1721 <dt class=
"hdlist1">subtree
</dt>
1723 <p>This is a modified
<code>ort
</code> strategy. When merging trees A and
1724 B, if B corresponds to a subtree of A, B is first adjusted to
1725 match the tree structure of A, instead of reading the trees at
1726 the same level. This adjustment is also done to the common
1731 <div class=
"paragraph">
1732 <p>With the strategies that use
3-way merge (including the default,
<em>ort
</em>),
1733 if a change is made on both branches, but later reverted on one of the
1734 branches, that change will be present in the merged result; some people find
1735 this behavior confusing. It occurs because only the heads and the merge base
1736 are considered when performing a merge, not the individual commits. The merge
1737 algorithm therefore considers the reverted change as no change at all, and
1738 substitutes the changed version instead.
</p>
1743 <h2 id=
"_notes">NOTES
</h2>
1744 <div class=
"sectionbody">
1745 <div class=
"paragraph">
1746 <p>You should understand the implications of using
<code>git
</code> <code>rebase
</code> on a
1747 repository that you share. See also RECOVERING FROM UPSTREAM REBASE
1750 <div class=
"paragraph">
1751 <p>When the rebase is run, it will first execute a
<code>pre-rebase
</code> hook if one
1752 exists. You can use this hook to do sanity checks and reject the rebase
1753 if it isn
’t appropriate. Please see the template
<code>pre-rebase
</code> hook script
1756 <div class=
"paragraph">
1757 <p>Upon completion,
<em><branch
></em> will be the current branch.
</p>
1762 <h2 id=
"_interactive_mode">INTERACTIVE MODE
</h2>
1763 <div class=
"sectionbody">
1764 <div class=
"paragraph">
1765 <p>Rebasing interactively means that you have a chance to edit the commits
1766 which are rebased. You can reorder the commits, and you can
1767 remove them (weeding out bad or otherwise unwanted patches).
</p>
1769 <div class=
"paragraph">
1770 <p>The interactive mode is meant for this type of workflow:
</p>
1772 <div class=
"olist arabic">
1775 <p>have a wonderful idea
</p>
1778 <p>hack on the code
</p>
1781 <p>prepare a series for submission
</p>
1788 <div class=
"paragraph">
1789 <p>where point
2. consists of several instances of
</p>
1791 <div class=
"paragraph">
1792 <p>a) regular use
</p>
1794 <div class=
"olist arabic">
1797 <p>finish something worthy of a commit
</p>
1804 <div class=
"paragraph">
1805 <p>b) independent fixup
</p>
1807 <div class=
"olist arabic">
1810 <p>realize that something does not work
</p>
1820 <div class=
"paragraph">
1821 <p>Sometimes the thing fixed in b
.2. cannot be amended to the not-quite
1822 perfect commit it fixes, because that commit is buried deeply in a
1823 patch series. That is exactly what interactive rebase is for: use it
1824 after plenty of
"a"s and
"b"s, by rearranging and editing
1825 commits, and squashing multiple commits into one.
</p>
1827 <div class=
"paragraph">
1828 <p>Start it with the last commit you want to retain as-is:
</p>
1830 <div class=
"literalblock">
1831 <div class=
"content">
1832 <pre>git rebase -i
<after-this-commit
></pre>
1835 <div class=
"paragraph">
1836 <p>An editor will be fired up with all the commits in your current branch
1837 (ignoring merge commits), which come after the given commit. You can
1838 reorder the commits in this list to your heart
’s content, and you can
1839 remove them. The list looks more or less like this:
</p>
1841 <div class=
"listingblock">
1842 <div class=
"content">
1843 <pre>pick deadbee The oneline of this commit
1844 pick fa1afe1 The oneline of the next commit
1848 <div class=
"paragraph">
1849 <p>The oneline descriptions are purely for your pleasure;
<em>git rebase
</em> will
1850 not look at them but at the commit names (
"deadbee" and
"fa1afe1" in this
1851 example), so do not delete or edit the names.
</p>
1853 <div class=
"paragraph">
1854 <p>By replacing the command
"pick" with the command
"edit", you can tell
1855 <code>git
</code> <code>rebase
</code> to stop after applying that commit, so that you can edit
1856 the files and/or the commit message, amend the commit, and continue
1859 <div class=
"paragraph">
1860 <p>To interrupt the rebase (just like an
"edit" command would do, but without
1861 cherry-picking any commit first), use the
"break" command.
</p>
1863 <div class=
"paragraph">
1864 <p>If you just want to edit the commit message for a commit, replace the
1865 command
"pick" with the command
"reword".
</p>
1867 <div class=
"paragraph">
1868 <p>To drop a commit, replace the command
"pick" with
"drop", or just
1869 delete the matching line.
</p>
1871 <div class=
"paragraph">
1872 <p>If you want to fold two or more commits into one, replace the command
1873 "pick" for the second and subsequent commits with
"squash" or
"fixup".
1874 If the commits had different authors, the folded commit will be
1875 attributed to the author of the first commit. The suggested commit
1876 message for the folded commit is the concatenation of the first
1877 commit
’s message with those identified by
"squash" commands, omitting the
1878 messages of commits identified by
"fixup" commands, unless
"fixup -c"
1879 is used. In that case the suggested commit message is only the message
1880 of the
"fixup -c" commit, and an editor is opened allowing you to edit
1881 the message. The contents (patch) of the
"fixup -c" commit are still
1882 incorporated into the folded commit. If there is more than one
"fixup -c"
1883 commit, the message from the final one is used. You can also use
1884 "fixup -C" to get the same behavior as
"fixup -c" except without opening
1887 <div class=
"paragraph">
1888 <p><code>git
</code> <code>rebase
</code> will stop when
"pick" has been replaced with
"edit" or
1889 when a command fails due to merge errors. When you are done editing
1890 and/or resolving conflicts you can continue with
<code>git
</code> <code>rebase
</code> <code>--continue
</code>.
</p>
1892 <div class=
"paragraph">
1893 <p>For example, if you want to reorder the last
5 commits, such that what
1894 was
<code>HEAD~
4</code> becomes the new
<code>HEAD
</code>. To achieve that, you would call
1895 <code>git
</code> <code>rebase
</code> like this:
</p>
1897 <div class=
"listingblock">
1898 <div class=
"content">
1899 <pre>$ git rebase -i HEAD~
5</pre>
1902 <div class=
"paragraph">
1903 <p>And move the first patch to the end of the list.
</p>
1905 <div class=
"paragraph">
1906 <p>You might want to recreate merge commits, e.g. if you have a history
1909 <div class=
"listingblock">
1910 <div class=
"content">
1915 ---o---O---P---Q
</pre>
1918 <div class=
"paragraph">
1919 <p>Suppose you want to rebase the side branch starting at
"A" to
"Q". Make
1920 sure that the current
<code>HEAD
</code> is
"B", and call
</p>
1922 <div class=
"listingblock">
1923 <div class=
"content">
1924 <pre>$ git rebase -i -r --onto Q O
</pre>
1927 <div class=
"paragraph">
1928 <p>Reordering and editing commits usually creates untested intermediate
1929 steps. You may want to check that your history editing did not break
1930 anything by running a test, or at least recompiling at intermediate
1931 points in history by using the
"exec" command (shortcut
"x"). You may
1932 do so by creating a todo list like this one:
</p>
1934 <div class=
"listingblock">
1935 <div class=
"content">
1936 <pre>pick deadbee Implement feature XXX
1937 fixup f1a5c00 Fix to feature XXX
1939 pick c0ffeee The oneline of the next commit
1940 edit deadbab The oneline of the commit after
1941 exec cd subdir; make test
1945 <div class=
"paragraph">
1946 <p>The interactive rebase will stop when a command fails (i.e. exits with
1947 non-
0 status) to give you an opportunity to fix the problem. You can
1948 continue with
<code>git
</code> <code>rebase
</code> <code>--continue
</code>.
</p>
1950 <div class=
"paragraph">
1951 <p>The
"exec" command launches the command in a shell (the default one, usually
1952 /bin/sh), so you can use shell features (like
"cd",
">",
";" …​). The command
1953 is run from the root of the working tree.
</p>
1955 <div class=
"listingblock">
1956 <div class=
"content">
1957 <pre>$ git rebase -i --exec
"make test"</pre>
1960 <div class=
"paragraph">
1961 <p>This command lets you check that intermediate commits are compilable.
1962 The todo list becomes like that:
</p>
1964 <div class=
"listingblock">
1965 <div class=
"content">
1966 <pre>pick
5928aea one
1973 exec make test
</pre>
1979 <h2 id=
"_splitting_commits">SPLITTING COMMITS
</h2>
1980 <div class=
"sectionbody">
1981 <div class=
"paragraph">
1982 <p>In interactive mode, you can mark commits with the action
"edit". However,
1983 this does not necessarily mean that
<code>git
</code> <code>rebase
</code> expects the result of this
1984 edit to be exactly one commit. Indeed, you can undo the commit, or you can
1985 add other commits. This can be used to split a commit into two:
</p>
1990 <p>Start an interactive rebase with
<code>git
</code> <code>rebase
</code> <code>-i
</code> <em><commit
></em><code>^
</code>, where
1991 <em><commit
></em> is the commit you want to split. In fact, any commit range
1992 will do, as long as it contains that commit.
</p>
1995 <p>Mark the commit you want to split with the action
"edit".
</p>
1998 <p>When it comes to editing that commit, execute
<code>git
</code> <code>reset
</code> <code>HEAD^
</code>. The
1999 effect is that the
<code>HEAD
</code> is rewound by one, and the index follows suit.
2000 However, the working tree stays the same.
</p>
2003 <p>Now add the changes to the index that you want to have in the first
2004 commit. You can use
<code>git
</code> <code>add
</code> (possibly interactively) or
2005 <code>git
</code> <code>gui
</code> (or both) to do that.
</p>
2008 <p>Commit the now-current index with whatever commit message is appropriate
2012 <p>Repeat the last two steps until your working tree is clean.
</p>
2015 <p>Continue the rebase with
<code>git
</code> <code>rebase
</code> <code>--continue
</code>.
</p>
2019 <div class=
"paragraph">
2020 <p>If you are not absolutely sure that the intermediate revisions are
2021 consistent (they compile, pass the testsuite, etc.) you should use
2022 <code>git
</code> <code>stash
</code> to stash away the not-yet-committed changes
2023 after each commit, test, and amend the commit if fixes are necessary.
</p>
2028 <h2 id=
"_recovering_from_upstream_rebase">RECOVERING FROM UPSTREAM REBASE
</h2>
2029 <div class=
"sectionbody">
2030 <div class=
"paragraph">
2031 <p>Rebasing (or any other form of rewriting) a branch that others have
2032 based work on is a bad idea: anyone downstream of it is forced to
2033 manually fix their history. This section explains how to do the fix
2034 from the downstream
’s point of view. The real fix, however, would be
2035 to avoid rebasing the upstream in the first place.
</p>
2037 <div class=
"paragraph">
2038 <p>To illustrate, suppose you are in a situation where someone develops a
2039 <em>subsystem
</em> branch, and you are working on a
<em>topic
</em> that is dependent
2040 on this
<em>subsystem
</em>. You might end up with a history like the
2043 <div class=
"listingblock">
2044 <div class=
"content">
2045 <pre> o---o---o---o---o---o---o---o master
2047 o---o---o---o---o subsystem
2049 *---*---* topic
</pre>
2052 <div class=
"paragraph">
2053 <p>If
<em>subsystem
</em> is rebased against
<em>master
</em>, the following happens:
</p>
2055 <div class=
"listingblock">
2056 <div class=
"content">
2057 <pre> o---o---o---o---o---o---o---o master
2059 o---o---o---o---o o'--o'--o'--o'--o' subsystem
2061 *---*---* topic
</pre>
2064 <div class=
"paragraph">
2065 <p>If you now continue development as usual, and eventually merge
<em>topic
</em>
2066 to
<em>subsystem
</em>, the commits from
<em>subsystem
</em> will remain duplicated forever:
</p>
2068 <div class=
"listingblock">
2069 <div class=
"content">
2070 <pre> o---o---o---o---o---o---o---o master
2072 o---o---o---o---o o'--o'--o'--o'--o'--M subsystem
2074 *---*---*-..........-*--* topic
</pre>
2077 <div class=
"paragraph">
2078 <p>Such duplicates are generally frowned upon because they clutter up
2079 history, making it harder to follow. To clean things up, you need to
2080 transplant the commits on
<em>topic
</em> to the new
<em>subsystem
</em> tip, i.e.,
2081 rebase
<em>topic
</em>. This becomes a ripple effect: anyone downstream from
2082 <em>topic
</em> is forced to rebase too, and so on!
</p>
2084 <div class=
"paragraph">
2085 <p>There are two kinds of fixes, discussed in the following subsections:
</p>
2089 <dt class=
"hdlist1">Easy case: The changes are literally the same.
</dt>
2091 <p>This happens if the
<em>subsystem
</em> rebase was a simple rebase and
2092 had no conflicts.
</p>
2094 <dt class=
"hdlist1">Hard case: The changes are not the same.
</dt>
2096 <p>This happens if the
<em>subsystem
</em> rebase had conflicts, or used
2097 <code>--interactive
</code> to omit, edit, squash, or fixup commits; or
2098 if the upstream used one of
<code>commit
</code> <code>--amend
</code>,
<code>reset
</code>, or
2099 a full history rewriting command like
2100 <a href=
"https://github.com/newren/git-filter-repo"><code>filter-repo
</code></a>.
</p>
2105 <h3 id=
"_the_easy_case">The easy case
</h3>
2106 <div class=
"paragraph">
2107 <p>Only works if the changes (patch IDs based on the diff contents) on
2108 <em>subsystem
</em> are literally the same before and after the rebase
2109 <em>subsystem
</em> did.
</p>
2111 <div class=
"paragraph">
2112 <p>In that case, the fix is easy because
<em>git rebase
</em> knows to skip
2113 changes that are already present in the new upstream (unless
2114 <code>--reapply-cherry-picks
</code> is given). So if you say
2115 (assuming you
’re on
<em>topic
</em>)
</p>
2117 <div class=
"listingblock">
2118 <div class=
"content">
2119 <pre> $ git rebase subsystem
</pre>
2122 <div class=
"paragraph">
2123 <p>you will end up with the fixed history
</p>
2125 <div class=
"listingblock">
2126 <div class=
"content">
2127 <pre> o---o---o---o---o---o---o---o master
2129 o'--o'--o'--o'--o' subsystem
2131 *---*---* topic
</pre>
2136 <h3 id=
"_the_hard_case">The hard case
</h3>
2137 <div class=
"paragraph">
2138 <p>Things get more complicated if the
<em>subsystem
</em> changes do not exactly
2139 correspond to the ones before the rebase.
</p>
2141 <div class=
"admonitionblock note">
2145 <div class=
"title">Note
</div>
2147 <td class=
"content">
2148 While an
"easy case recovery" sometimes appears to be successful
2149 even in the hard case, it may have unintended consequences. For
2150 example, a commit that was removed via
<code>git
</code> <code>rebase
</code>
2151 <code>--interactive
</code> will be
<strong>resurrected
</strong>!
2156 <div class=
"paragraph">
2157 <p>The idea is to manually tell
<code>git
</code> <code>rebase
</code> "where the old <em>subsystem</em>
2158 ended and your <em>topic</em> began", that is, what the old merge base
2159 between them was. You will have to find a way to name the last commit
2160 of the old
<em>subsystem
</em>, for example:
</p>
2165 <p>With the
<em>subsystem
</em> reflog: after
<code>git
</code> <code>fetch
</code>, the old tip of
2166 <em>subsystem
</em> is at
<code>subsystem@
</code>{
1}. Subsequent fetches will
2167 increase the number. (See
<a href=
"git-reflog.html">git-reflog(
1)
</a>.)
</p>
2170 <p>Relative to the tip of
<em>topic
</em>: knowing that your
<em>topic
</em> has three
2171 commits, the old tip of
<em>subsystem
</em> must be
<code>topic~
3</code>.
</p>
2175 <div class=
"paragraph">
2176 <p>You can then transplant the old
<code>subsystem
</code><code>..
</code><code>topic
</code> to the new tip by
2177 saying (for the reflog case, and assuming you are on
<em>topic
</em> already):
</p>
2179 <div class=
"listingblock">
2180 <div class=
"content">
2181 <pre> $ git rebase --onto subsystem subsystem@{
1}
</pre>
2184 <div class=
"paragraph">
2185 <p>The ripple effect of a
"hard case" recovery is especially bad:
2186 <em>everyone
</em> downstream from
<em>topic
</em> will now have to perform a
"hard
2187 case" recovery too!
</p>
2193 <h2 id=
"_rebasing_merges">REBASING MERGES
</h2>
2194 <div class=
"sectionbody">
2195 <div class=
"paragraph">
2196 <p>The interactive rebase command was originally designed to handle
2197 individual patch series. As such, it makes sense to exclude merge
2198 commits from the todo list, as the developer may have merged the
2199 then-current
<code>master
</code> while working on the branch, only to rebase
2200 all the commits onto
<code>master
</code> eventually (skipping the merge
2203 <div class=
"paragraph">
2204 <p>However, there are legitimate reasons why a developer may want to
2205 recreate merge commits: to keep the branch structure (or
"commit
2206 topology") when working on multiple, inter-related branches.
</p>
2208 <div class=
"paragraph">
2209 <p>In the following example, the developer works on a topic branch that
2210 refactors the way buttons are defined, and on another topic branch
2211 that uses that refactoring to implement a
"Report a bug" button. The
2212 output of
<code>git
</code> <code>log
</code> <code>--graph
</code> <code>--format=
</code>%s
<code>-
5</code> may look like this:
</p>
2214 <div class=
"listingblock">
2215 <div class=
"content">
2216 <pre>* Merge branch 'report-a-bug'
2218 | * Add the feedback button
2219 * | Merge branch 'refactor-button'
2222 | * Use the Button class for all buttons
2223 | * Extract a generic Button class from the DownloadButton one
</pre>
2226 <div class=
"paragraph">
2227 <p>The developer might want to rebase those commits to a newer
<code>master
</code>
2228 while keeping the branch topology, for example when the first topic
2229 branch is expected to be integrated into
<code>master
</code> much earlier than the
2230 second one, say, to resolve merge conflicts with changes to the
2231 DownloadButton class that made it into
<code>master
</code>.
</p>
2233 <div class=
"paragraph">
2234 <p>This rebase can be performed using the
<code>--rebase-merges
</code> option.
2235 It will generate a todo list looking like this:
</p>
2237 <div class=
"listingblock">
2238 <div class=
"content">
2241 # Branch: refactor-button
2243 pick
123456 Extract a generic Button class from the DownloadButton one
2244 pick
654321 Use the Button class for all buttons
2245 label refactor-button
2247 # Branch: report-a-bug
2248 reset refactor-button # Use the Button class for all buttons
2249 pick abcdef Add the feedback button
2253 merge -C a1b2c3 refactor-button # Merge 'refactor-button'
2254 merge -C
6f5e4d report-a-bug # Merge 'report-a-bug'
</pre>
2257 <div class=
"paragraph">
2258 <p>In contrast to a regular interactive rebase, there are
<code>label
</code>,
<code>reset
</code>
2259 and
<code>merge
</code> commands in addition to
<code>pick
</code> ones.
</p>
2261 <div class=
"paragraph">
2262 <p>The
<code>label
</code> command associates a label with the current HEAD when that
2263 command is executed. These labels are created as worktree-local refs
2264 (
<code>refs/rewritten/
</code><em><label
></em>) that will be deleted when the rebase
2265 finishes. That way, rebase operations in multiple worktrees linked to
2266 the same repository do not interfere with one another. If the
<code>label
</code>
2267 command fails, it is rescheduled immediately, with a helpful message how
2270 <div class=
"paragraph">
2271 <p>The
<code>reset
</code> command resets the HEAD, index and worktree to the specified
2272 revision. It is similar to an
<code>exec
</code> <code>git
</code> <code>reset
</code> <code>--hard
</code> <em><label
></em>, but
2273 refuses to overwrite untracked files. If the
<code>reset
</code> command fails, it is
2274 rescheduled immediately, with a helpful message how to edit the todo list
2275 (this typically happens when a
<code>reset
</code> command was inserted into the todo
2276 list manually and contains a typo).
</p>
2278 <div class=
"paragraph">
2279 <p>The
<code>merge
</code> command will merge the specified revision(s) into whatever
2280 is HEAD at that time. With
<code>-C
</code> <em><original-commit
></em>, the commit message of
2281 the specified merge commit will be used. When the
<code>-C
</code> is changed to
2282 a lower-case
<code>-c
</code>, the message will be opened in an editor after a
2283 successful merge so that the user can edit the message.
</p>
2285 <div class=
"paragraph">
2286 <p>If a
<code>merge
</code> command fails for any reason other than merge conflicts (i.e.
2287 when the merge operation did not even start), it is rescheduled immediately.
</p>
2289 <div class=
"paragraph">
2290 <p>By default, the
<code>merge
</code> command will use the
<code>ort
</code> merge strategy for
2291 regular merges, and
<code>octopus
</code> for octopus merges. One can specify a
2292 default strategy for all merges using the
<code>--strategy
</code> argument when
2293 invoking rebase, or can override specific merges in the interactive
2294 list of commands by using an
<code>exec
</code> command to call
<code>git
</code> <code>merge
</code>
2295 explicitly with a
<code>--strategy
</code> argument. Note that when calling
<code>git
</code>
2296 <code>merge
</code> explicitly like this, you can make use of the fact that the
2297 labels are worktree-local refs (the ref
<code>refs/rewritten/onto
</code> would
2298 correspond to the label
<code>onto
</code>, for example) in order to refer to the
2299 branches you want to merge.
</p>
2301 <div class=
"paragraph">
2302 <p>Note: the first command (
<code>label
</code> <code>onto
</code>) labels the revision onto which
2303 the commits are rebased; The name
<code>onto
</code> is just a convention, as a nod
2304 to the
<code>--onto
</code> option.
</p>
2306 <div class=
"paragraph">
2307 <p>It is also possible to introduce completely new merge commits from scratch
2308 by adding a command of the form
<code>merge
</code> <em><merge-head
></em>. This form will
2309 generate a tentative commit message and always open an editor to let the
2310 user edit it. This can be useful e.g. when a topic branch turns out to
2311 address more than a single concern and wants to be split into two or
2312 even more topic branches. Consider this todo list:
</p>
2314 <div class=
"listingblock">
2315 <div class=
"content">
2316 <pre>pick
192837 Switch from GNU Makefiles to CMake
2317 pick
5a6c7e Document the switch to CMake
2318 pick
918273 Fix detection of OpenSSL in CMake
2319 pick afbecd http: add support for TLS v1.3
2320 pick fdbaec Fix detection of cURL in CMake on Windows
</pre>
2323 <div class=
"paragraph">
2324 <p>The one commit in this list that is not related to CMake may very well
2325 have been motivated by working on fixing all those bugs introduced by
2326 switching to CMake, but it addresses a different concern. To split this
2327 branch into two topic branches, the todo list could be edited like this:
</p>
2329 <div class=
"listingblock">
2330 <div class=
"content">
2333 pick afbecd http: add support for TLS v1.3
2337 pick
192837 Switch from GNU Makefiles to CMake
2338 pick
918273 Fix detection of OpenSSL in CMake
2339 pick fdbaec Fix detection of cURL in CMake on Windows
2340 pick
5a6c7e Document the switch to CMake
2351 <h2 id=
"_configuration">CONFIGURATION
</h2>
2352 <div class=
"sectionbody">
2353 <div class=
"paragraph">
2354 <p>Everything below this line in this section is selectively included
2355 from the
<a href=
"git-config.html">git-config(
1)
</a> documentation. The content is the same
2356 as what
’s found there:
</p>
2360 <dt class=
"hdlist1">rebase.backend
</dt>
2362 <p>Default backend to use for rebasing. Possible choices are
2363 <em>apply
</em> or
<em>merge
</em>. In the future, if the merge backend gains
2364 all remaining capabilities of the apply backend, this setting
2365 may become unused.
</p>
2367 <dt class=
"hdlist1">rebase.stat
</dt>
2369 <p>Whether to show a diffstat of what changed upstream since the last
2370 rebase. False by default.
</p>
2372 <dt class=
"hdlist1">rebase.autoSquash
</dt>
2374 <p>If set to true, enable the
<code>--autosquash
</code> option of
2375 <a href=
"git-rebase.html">git-rebase(
1)
</a> by default for interactive mode.
2376 This can be overridden with the
<code>--no-autosquash
</code> option.
</p>
2378 <dt class=
"hdlist1">rebase.autoStash
</dt>
2380 <p>When set to true, automatically create a temporary stash entry
2381 before the operation begins, and apply it after the operation
2382 ends. This means that you can run rebase on a dirty worktree.
2383 However, use with care: the final stash application after a
2384 successful rebase might result in non-trivial conflicts.
2385 This option can be overridden by the
<code>--no-autostash
</code> and
2386 <code>--autostash
</code> options of
<a href=
"git-rebase.html">git-rebase(
1)
</a>.
2387 Defaults to false.
</p>
2389 <dt class=
"hdlist1">rebase.updateRefs
</dt>
2391 <p>If set to true enable
<code>--update-refs
</code> option by default.
</p>
2393 <dt class=
"hdlist1">rebase.missingCommitsCheck
</dt>
2395 <p>If set to
"warn", git rebase -i will print a warning if some
2396 commits are removed (e.g. a line was deleted), however the
2397 rebase will still proceed. If set to
"error", it will print
2398 the previous warning and stop the rebase,
<em>git rebase
2399 --edit-todo
</em> can then be used to correct the error. If set to
2400 "ignore", no checking is done.
2401 To drop a commit without warning or error, use the
<code>drop
</code>
2402 command in the todo list.
2403 Defaults to
"ignore".
</p>
2405 <dt class=
"hdlist1">rebase.instructionFormat
</dt>
2407 <p>A format string, as specified in
<a href=
"git-log.html">git-log(
1)
</a>, to be used for the
2408 todo list during an interactive rebase. The format will
2409 automatically have the commit hash prepended to the format.
</p>
2411 <dt class=
"hdlist1">rebase.abbreviateCommands
</dt>
2413 <p>If set to true,
<code>git
</code> <code>rebase
</code> will use abbreviated command names in the
2414 todo list resulting in something like this:
</p>
2415 <div class=
"listingblock">
2416 <div class=
"content">
2417 <pre> p deadbee The oneline of the commit
2418 p fa1afe1 The oneline of the next commit
2422 <div class=
"paragraph">
2425 <div class=
"listingblock">
2426 <div class=
"content">
2427 <pre> pick deadbee The oneline of the commit
2428 pick fa1afe1 The oneline of the next commit
2432 <div class=
"paragraph">
2433 <p>Defaults to false.
</p>
2436 <dt class=
"hdlist1">rebase.rescheduleFailedExec
</dt>
2438 <p>Automatically reschedule
<code>exec
</code> commands that failed. This only makes
2439 sense in interactive mode (or when an
<code>--exec
</code> option was provided).
2440 This is the same as specifying the
<code>--reschedule-failed-exec
</code> option.
</p>
2442 <dt class=
"hdlist1">rebase.forkPoint
</dt>
2444 <p>If set to false set
<code>--no-fork-point
</code> option by default.
</p>
2446 <dt class=
"hdlist1">rebase.rebaseMerges
</dt>
2448 <p>Whether and how to set the
<code>--rebase-merges
</code> option by default. Can
2449 be
<code>rebase-cousins
</code>,
<code>no-rebase-cousins
</code>, or a boolean. Setting to
2450 true or to
<code>no-rebase-cousins
</code> is equivalent to
2451 <code>--rebase-merges=no-rebase-cousins
</code>, setting to
<code>rebase-cousins
</code> is
2452 equivalent to
<code>--rebase-merges=rebase-cousins
</code>, and setting to false is
2453 equivalent to
<code>--no-rebase-merges
</code>. Passing
<code>--rebase-merges
</code> on the
2454 command line, with or without an argument, overrides any
2455 <code>rebase.rebaseMerges
</code> configuration.
</p>
2457 <dt class=
"hdlist1">rebase.maxLabelLength
</dt>
2459 <p>When generating label names from commit subjects, truncate the names to
2460 this length. By default, the names are truncated to a little less than
2461 <code>NAME_MAX
</code> (to allow e.g. .
<code>lock
</code> files to be written for the
2462 corresponding loose refs).
</p>
2464 <dt class=
"hdlist1">sequence.editor
</dt>
2466 <p>Text editor used by
<code>git
</code> <code>rebase
</code> <code>-i
</code> for editing the rebase instruction file.
2467 The value is meant to be interpreted by the shell when it is used.
2468 It can be overridden by the
<code>GIT_SEQUENCE_EDITOR
</code> environment variable.
2469 When not configured, the default commit message editor is used instead.
</p>
2476 <h2 id=
"_git">GIT
</h2>
2477 <div class=
"sectionbody">
2478 <div class=
"paragraph">
2479 <p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p>
2485 <div id=
"footer-text">
2486 Last updated
2024-
08-
01 11:
26:
42 -
0700