Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
| 2 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| 4 | <head> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 5 | <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 8.6.9" /> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 7 | <title>git-rebase(1)</title> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 8 | <style type="text/css"> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 9 | /* Shared CSS for AsciiDoc xhtml11 and html5 backends */ |
| 10 | |
| 11 | /* Default font. */ |
| 12 | body { |
| 13 | font-family: Georgia,serif; |
| 14 | } |
| 15 | |
| 16 | /* Title font. */ |
| 17 | h1, h2, h3, h4, h5, h6, |
| 18 | div.title, caption.title, |
| 19 | thead, p.table.header, |
| 20 | #toctitle, |
| 21 | #author, #revnumber, #revdate, #revremark, |
| 22 | #footer { |
| 23 | font-family: Arial,Helvetica,sans-serif; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | body { |
| 27 | margin: 1em 5% 1em 5%; |
| 28 | } |
| 29 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 30 | a { |
| 31 | color: blue; |
| 32 | text-decoration: underline; |
| 33 | } |
| 34 | a:visited { |
| 35 | color: fuchsia; |
| 36 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 37 | |
| 38 | em { |
| 39 | font-style: italic; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 40 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | strong { |
| 44 | font-weight: bold; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 45 | color: #083194; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 46 | } |
| 47 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 48 | h1, h2, h3, h4, h5, h6 { |
| 49 | color: #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 50 | margin-top: 1.2em; |
| 51 | margin-bottom: 0.5em; |
| 52 | line-height: 1.3; |
| 53 | } |
| 54 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 55 | h1, h2, h3 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 56 | border-bottom: 2px solid silver; |
| 57 | } |
| 58 | h2 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 59 | padding-top: 0.5em; |
| 60 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 61 | h3 { |
| 62 | float: left; |
| 63 | } |
| 64 | h3 + * { |
| 65 | clear: left; |
| 66 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 67 | h5 { |
| 68 | font-size: 1.0em; |
| 69 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 70 | |
| 71 | div.sectionbody { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 72 | margin-left: 0; |
| 73 | } |
| 74 | |
| 75 | hr { |
| 76 | border: 1px solid silver; |
| 77 | } |
| 78 | |
| 79 | p { |
| 80 | margin-top: 0.5em; |
| 81 | margin-bottom: 0.5em; |
| 82 | } |
| 83 | |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 84 | ul, ol, li > p { |
| 85 | margin-top: 0; |
| 86 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 87 | ul > li { color: #aaa; } |
| 88 | ul > li > * { color: black; } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 89 | |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 90 | .monospaced, code, pre { |
| 91 | font-family: "Courier New", Courier, monospace; |
| 92 | font-size: inherit; |
| 93 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 94 | padding: 0; |
| 95 | margin: 0; |
| 96 | } |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 97 | pre { |
| 98 | white-space: pre-wrap; |
| 99 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 100 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 101 | #author { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 102 | color: #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 103 | font-weight: bold; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 104 | font-size: 1.1em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 105 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 106 | #email { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 107 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 108 | #revnumber, #revdate, #revremark { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 109 | } |
| 110 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 111 | #footer { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 112 | font-size: small; |
| 113 | border-top: 2px solid silver; |
| 114 | padding-top: 0.5em; |
| 115 | margin-top: 4.0em; |
| 116 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 117 | #footer-text { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 118 | float: left; |
| 119 | padding-bottom: 0.5em; |
| 120 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 121 | #footer-badges { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 122 | float: right; |
| 123 | padding-bottom: 0.5em; |
| 124 | } |
| 125 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 126 | #preamble { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 127 | margin-top: 1.5em; |
| 128 | margin-bottom: 1.5em; |
| 129 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 130 | div.imageblock, div.exampleblock, div.verseblock, |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 131 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 132 | div.admonitionblock { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 133 | margin-top: 1.0em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 134 | margin-bottom: 1.5em; |
| 135 | } |
| 136 | div.admonitionblock { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 137 | margin-top: 2.0em; |
| 138 | margin-bottom: 2.0em; |
| 139 | margin-right: 10%; |
| 140 | color: #606060; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | div.content { /* Block element content. */ |
| 144 | padding: 0; |
| 145 | } |
| 146 | |
| 147 | /* Block element titles. */ |
| 148 | div.title, caption.title { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 149 | color: #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 150 | font-weight: bold; |
| 151 | text-align: left; |
| 152 | margin-top: 1.0em; |
| 153 | margin-bottom: 0.5em; |
| 154 | } |
| 155 | div.title + * { |
| 156 | margin-top: 0; |
| 157 | } |
| 158 | |
| 159 | td div.title:first-child { |
| 160 | margin-top: 0.0em; |
| 161 | } |
| 162 | div.content div.title:first-child { |
| 163 | margin-top: 0.0em; |
| 164 | } |
| 165 | div.content + div.title { |
| 166 | margin-top: 0.0em; |
| 167 | } |
| 168 | |
| 169 | div.sidebarblock > div.content { |
| 170 | background: #ffffee; |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 171 | border: 1px solid #dddddd; |
| 172 | border-left: 4px solid #f0f0f0; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 173 | padding: 0.5em; |
| 174 | } |
| 175 | |
| 176 | div.listingblock > div.content { |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 177 | border: 1px solid #dddddd; |
| 178 | border-left: 5px solid #f0f0f0; |
| 179 | background: #f8f8f8; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 180 | padding: 0.5em; |
| 181 | } |
| 182 | |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 183 | div.quoteblock, div.verseblock { |
| 184 | padding-left: 1.0em; |
| 185 | margin-left: 1.0em; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 186 | margin-right: 10%; |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 187 | border-left: 5px solid #f0f0f0; |
| 188 | color: #888; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 189 | } |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 190 | |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 191 | div.quoteblock > div.attribution { |
| 192 | padding-top: 0.5em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 193 | text-align: right; |
| 194 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 195 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 196 | div.verseblock > pre.content { |
| 197 | font-family: inherit; |
| 198 | font-size: inherit; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 199 | } |
| 200 | div.verseblock > div.attribution { |
| 201 | padding-top: 0.75em; |
| 202 | text-align: left; |
| 203 | } |
| 204 | /* DEPRECATED: Pre version 8.2.7 verse style literal block. */ |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 205 | div.verseblock + div.attribution { |
| 206 | text-align: left; |
| 207 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 208 | |
| 209 | div.admonitionblock .icon { |
| 210 | vertical-align: top; |
| 211 | font-size: 1.1em; |
| 212 | font-weight: bold; |
| 213 | text-decoration: underline; |
| 214 | color: #527bbd; |
| 215 | padding-right: 0.5em; |
| 216 | } |
| 217 | div.admonitionblock td.content { |
| 218 | padding-left: 0.5em; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 219 | border-left: 3px solid #dddddd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | div.exampleblock > div.content { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 223 | border-left: 3px solid #dddddd; |
| 224 | padding-left: 0.5em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 225 | } |
| 226 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 227 | div.imageblock div.content { padding-left: 0; } |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 228 | span.image img { border-style: none; vertical-align: text-bottom; } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 229 | a.image:visited { color: white; } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 230 | |
| 231 | dl { |
| 232 | margin-top: 0.8em; |
| 233 | margin-bottom: 0.8em; |
| 234 | } |
| 235 | dt { |
| 236 | margin-top: 0.5em; |
| 237 | margin-bottom: 0; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 238 | font-style: normal; |
| 239 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 240 | } |
| 241 | dd > *:first-child { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 242 | margin-top: 0.1em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | ul, ol { |
| 246 | list-style-position: outside; |
| 247 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 248 | ol.arabic { |
| 249 | list-style-type: decimal; |
| 250 | } |
| 251 | ol.loweralpha { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 252 | list-style-type: lower-alpha; |
| 253 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 254 | ol.upperalpha { |
| 255 | list-style-type: upper-alpha; |
| 256 | } |
| 257 | ol.lowerroman { |
| 258 | list-style-type: lower-roman; |
| 259 | } |
| 260 | ol.upperroman { |
| 261 | list-style-type: upper-roman; |
| 262 | } |
| 263 | |
| 264 | div.compact ul, div.compact ol, |
| 265 | div.compact p, div.compact p, |
| 266 | div.compact div, div.compact div { |
| 267 | margin-top: 0.1em; |
| 268 | margin-bottom: 0.1em; |
| 269 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 270 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 271 | tfoot { |
| 272 | font-weight: bold; |
| 273 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 274 | td > div.verse { |
| 275 | white-space: pre; |
| 276 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 277 | |
| 278 | div.hdlist { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 279 | margin-top: 0.8em; |
| 280 | margin-bottom: 0.8em; |
| 281 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 282 | div.hdlist tr { |
| 283 | padding-bottom: 15px; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 284 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 285 | dt.hdlist1.strong, td.hdlist1.strong { |
| 286 | font-weight: bold; |
| 287 | } |
| 288 | td.hdlist1 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 289 | vertical-align: top; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 290 | font-style: normal; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 291 | padding-right: 0.8em; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 292 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 293 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 294 | td.hdlist2 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 295 | vertical-align: top; |
| 296 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 297 | div.hdlist.compact tr { |
| 298 | margin: 0; |
| 299 | padding-bottom: 0; |
| 300 | } |
| 301 | |
| 302 | .comment { |
| 303 | background: yellow; |
| 304 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 305 | |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 306 | .footnote, .footnoteref { |
| 307 | font-size: 0.8em; |
| 308 | } |
| 309 | |
| 310 | span.footnote, span.footnoteref { |
| 311 | vertical-align: super; |
| 312 | } |
| 313 | |
| 314 | #footnotes { |
| 315 | margin: 20px 0 20px 0; |
| 316 | padding: 7px 0 0 0; |
| 317 | } |
| 318 | |
| 319 | #footnotes div.footnote { |
| 320 | margin: 0 0 5px 0; |
| 321 | } |
| 322 | |
| 323 | #footnotes hr { |
| 324 | border: none; |
| 325 | border-top: 1px solid silver; |
| 326 | height: 1px; |
| 327 | text-align: left; |
| 328 | margin-left: 0; |
| 329 | width: 20%; |
| 330 | min-width: 100px; |
| 331 | } |
| 332 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 333 | div.colist td { |
| 334 | padding-right: 0.5em; |
| 335 | padding-bottom: 0.3em; |
| 336 | vertical-align: top; |
| 337 | } |
| 338 | div.colist td img { |
| 339 | margin-top: 0.3em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 340 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 341 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 342 | @media print { |
| 343 | #footer-badges { display: none; } |
| 344 | } |
| 345 | |
| 346 | #toc { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 347 | margin-bottom: 2.5em; |
| 348 | } |
| 349 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 350 | #toctitle { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 351 | color: #527bbd; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 352 | font-size: 1.1em; |
| 353 | font-weight: bold; |
| 354 | margin-top: 1.0em; |
| 355 | margin-bottom: 0.1em; |
| 356 | } |
| 357 | |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 358 | div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 359 | margin-top: 0; |
| 360 | margin-bottom: 0; |
| 361 | } |
| 362 | div.toclevel2 { |
| 363 | margin-left: 2em; |
| 364 | font-size: 0.9em; |
| 365 | } |
| 366 | div.toclevel3 { |
| 367 | margin-left: 4em; |
| 368 | font-size: 0.9em; |
| 369 | } |
| 370 | div.toclevel4 { |
| 371 | margin-left: 6em; |
| 372 | font-size: 0.9em; |
| 373 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 374 | |
| 375 | span.aqua { color: aqua; } |
| 376 | span.black { color: black; } |
| 377 | span.blue { color: blue; } |
| 378 | span.fuchsia { color: fuchsia; } |
| 379 | span.gray { color: gray; } |
| 380 | span.green { color: green; } |
| 381 | span.lime { color: lime; } |
| 382 | span.maroon { color: maroon; } |
| 383 | span.navy { color: navy; } |
| 384 | span.olive { color: olive; } |
| 385 | span.purple { color: purple; } |
| 386 | span.red { color: red; } |
| 387 | span.silver { color: silver; } |
| 388 | span.teal { color: teal; } |
| 389 | span.white { color: white; } |
| 390 | span.yellow { color: yellow; } |
| 391 | |
| 392 | span.aqua-background { background: aqua; } |
| 393 | span.black-background { background: black; } |
| 394 | span.blue-background { background: blue; } |
| 395 | span.fuchsia-background { background: fuchsia; } |
| 396 | span.gray-background { background: gray; } |
| 397 | span.green-background { background: green; } |
| 398 | span.lime-background { background: lime; } |
| 399 | span.maroon-background { background: maroon; } |
| 400 | span.navy-background { background: navy; } |
| 401 | span.olive-background { background: olive; } |
| 402 | span.purple-background { background: purple; } |
| 403 | span.red-background { background: red; } |
| 404 | span.silver-background { background: silver; } |
| 405 | span.teal-background { background: teal; } |
| 406 | span.white-background { background: white; } |
| 407 | span.yellow-background { background: yellow; } |
| 408 | |
| 409 | span.big { font-size: 2em; } |
| 410 | span.small { font-size: 0.6em; } |
| 411 | |
| 412 | span.underline { text-decoration: underline; } |
| 413 | span.overline { text-decoration: overline; } |
| 414 | span.line-through { text-decoration: line-through; } |
| 415 | |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 416 | div.unbreakable { page-break-inside: avoid; } |
| 417 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 418 | |
| 419 | /* |
| 420 | * xhtml11 specific |
| 421 | * |
| 422 | * */ |
| 423 | |
| 424 | div.tableblock { |
| 425 | margin-top: 1.0em; |
| 426 | margin-bottom: 1.5em; |
| 427 | } |
| 428 | div.tableblock > table { |
| 429 | border: 3px solid #527bbd; |
| 430 | } |
| 431 | thead, p.table.header { |
| 432 | font-weight: bold; |
| 433 | color: #527bbd; |
| 434 | } |
| 435 | p.table { |
| 436 | margin-top: 0; |
| 437 | } |
| 438 | /* Because the table frame attribute is overriden by CSS in most browsers. */ |
| 439 | div.tableblock > table[frame="void"] { |
| 440 | border-style: none; |
| 441 | } |
| 442 | div.tableblock > table[frame="hsides"] { |
| 443 | border-left-style: none; |
| 444 | border-right-style: none; |
| 445 | } |
| 446 | div.tableblock > table[frame="vsides"] { |
| 447 | border-top-style: none; |
| 448 | border-bottom-style: none; |
| 449 | } |
| 450 | |
| 451 | |
| 452 | /* |
| 453 | * html5 specific |
| 454 | * |
| 455 | * */ |
| 456 | |
| 457 | table.tableblock { |
| 458 | margin-top: 1.0em; |
| 459 | margin-bottom: 1.5em; |
| 460 | } |
| 461 | thead, p.tableblock.header { |
| 462 | font-weight: bold; |
| 463 | color: #527bbd; |
| 464 | } |
| 465 | p.tableblock { |
| 466 | margin-top: 0; |
| 467 | } |
| 468 | table.tableblock { |
| 469 | border-width: 3px; |
| 470 | border-spacing: 0px; |
| 471 | border-style: solid; |
| 472 | border-color: #527bbd; |
| 473 | border-collapse: collapse; |
| 474 | } |
| 475 | th.tableblock, td.tableblock { |
| 476 | border-width: 1px; |
| 477 | padding: 4px; |
| 478 | border-style: solid; |
| 479 | border-color: #527bbd; |
| 480 | } |
| 481 | |
| 482 | table.tableblock.frame-topbot { |
| 483 | border-left-style: hidden; |
| 484 | border-right-style: hidden; |
| 485 | } |
| 486 | table.tableblock.frame-sides { |
| 487 | border-top-style: hidden; |
| 488 | border-bottom-style: hidden; |
| 489 | } |
| 490 | table.tableblock.frame-none { |
| 491 | border-style: hidden; |
| 492 | } |
| 493 | |
| 494 | th.tableblock.halign-left, td.tableblock.halign-left { |
| 495 | text-align: left; |
| 496 | } |
| 497 | th.tableblock.halign-center, td.tableblock.halign-center { |
| 498 | text-align: center; |
| 499 | } |
| 500 | th.tableblock.halign-right, td.tableblock.halign-right { |
| 501 | text-align: right; |
| 502 | } |
| 503 | |
| 504 | th.tableblock.valign-top, td.tableblock.valign-top { |
| 505 | vertical-align: top; |
| 506 | } |
| 507 | th.tableblock.valign-middle, td.tableblock.valign-middle { |
| 508 | vertical-align: middle; |
| 509 | } |
| 510 | th.tableblock.valign-bottom, td.tableblock.valign-bottom { |
| 511 | vertical-align: bottom; |
| 512 | } |
| 513 | |
| 514 | |
| 515 | /* |
| 516 | * manpage specific |
| 517 | * |
| 518 | * */ |
| 519 | |
| 520 | body.manpage h1 { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 521 | padding-top: 0.5em; |
| 522 | padding-bottom: 0.5em; |
| 523 | border-top: 2px solid silver; |
| 524 | border-bottom: 2px solid silver; |
| 525 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 526 | body.manpage h2 { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 527 | border-style: none; |
| 528 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 529 | body.manpage div.sectionbody { |
| 530 | margin-left: 3em; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 531 | } |
| 532 | |
| 533 | @media print { |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 534 | body.manpage div#toc { display: none; } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 535 | } |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 536 | |
| 537 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 538 | </style> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 539 | <script type="text/javascript"> |
| 540 | /*<![CDATA[*/ |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 541 | var asciidoc = { // Namespace. |
| 542 | |
| 543 | ///////////////////////////////////////////////////////////////////// |
| 544 | // Table Of Contents generator |
| 545 | ///////////////////////////////////////////////////////////////////// |
| 546 | |
| 547 | /* Author: Mihai Bazon, September 2002 |
| 548 | * http://students.infoiasi.ro/~mishoo |
| 549 | * |
| 550 | * Table Of Content generator |
| 551 | * Version: 0.4 |
| 552 | * |
| 553 | * Feel free to use this script under the terms of the GNU General Public |
| 554 | * License, as long as you do not remove or alter this notice. |
| 555 | */ |
| 556 | |
| 557 | /* modified by Troy D. Hanson, September 2006. License: GPL */ |
| 558 | /* modified by Stuart Rackham, 2006, 2009. License: GPL */ |
| 559 | |
| 560 | // toclevels = 1..4. |
| 561 | toc: function (toclevels) { |
| 562 | |
| 563 | function getText(el) { |
| 564 | var text = ""; |
| 565 | for (var i = el.firstChild; i != null; i = i.nextSibling) { |
| 566 | if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants. |
| 567 | text += i.data; |
| 568 | else if (i.firstChild != null) |
| 569 | text += getText(i); |
| 570 | } |
| 571 | return text; |
| 572 | } |
| 573 | |
| 574 | function TocEntry(el, text, toclevel) { |
| 575 | this.element = el; |
| 576 | this.text = text; |
| 577 | this.toclevel = toclevel; |
| 578 | } |
| 579 | |
| 580 | function tocEntries(el, toclevels) { |
| 581 | var result = new Array; |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 582 | var re = new RegExp('[hH]([1-'+(toclevels+1)+'])'); |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 583 | // Function that scans the DOM tree for header elements (the DOM2 |
| 584 | // nodeIterator API would be a better technique but not supported by all |
| 585 | // browsers). |
| 586 | var iterate = function (el) { |
| 587 | for (var i = el.firstChild; i != null; i = i.nextSibling) { |
| 588 | if (i.nodeType == 1 /* Node.ELEMENT_NODE */) { |
| 589 | var mo = re.exec(i.tagName); |
| 590 | if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") { |
| 591 | result[result.length] = new TocEntry(i, getText(i), mo[1]-1); |
| 592 | } |
| 593 | iterate(i); |
| 594 | } |
| 595 | } |
| 596 | } |
| 597 | iterate(el); |
| 598 | return result; |
| 599 | } |
| 600 | |
| 601 | var toc = document.getElementById("toc"); |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 602 | if (!toc) { |
| 603 | return; |
| 604 | } |
| 605 | |
| 606 | // Delete existing TOC entries in case we're reloading the TOC. |
| 607 | var tocEntriesToRemove = []; |
| 608 | var i; |
| 609 | for (i = 0; i < toc.childNodes.length; i++) { |
| 610 | var entry = toc.childNodes[i]; |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 611 | if (entry.nodeName.toLowerCase() == 'div' |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 612 | && entry.getAttribute("class") |
| 613 | && entry.getAttribute("class").match(/^toclevel/)) |
| 614 | tocEntriesToRemove.push(entry); |
| 615 | } |
| 616 | for (i = 0; i < tocEntriesToRemove.length; i++) { |
| 617 | toc.removeChild(tocEntriesToRemove[i]); |
| 618 | } |
| 619 | |
| 620 | // Rebuild TOC entries. |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 621 | var entries = tocEntries(document.getElementById("content"), toclevels); |
| 622 | for (var i = 0; i < entries.length; ++i) { |
| 623 | var entry = entries[i]; |
| 624 | if (entry.element.id == "") |
| 625 | entry.element.id = "_toc_" + i; |
| 626 | var a = document.createElement("a"); |
| 627 | a.href = "#" + entry.element.id; |
| 628 | a.appendChild(document.createTextNode(entry.text)); |
| 629 | var div = document.createElement("div"); |
| 630 | div.appendChild(a); |
| 631 | div.className = "toclevel" + entry.toclevel; |
| 632 | toc.appendChild(div); |
| 633 | } |
| 634 | if (entries.length == 0) |
| 635 | toc.parentNode.removeChild(toc); |
| 636 | }, |
| 637 | |
| 638 | |
| 639 | ///////////////////////////////////////////////////////////////////// |
| 640 | // Footnotes generator |
| 641 | ///////////////////////////////////////////////////////////////////// |
| 642 | |
| 643 | /* Based on footnote generation code from: |
| 644 | * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html |
| 645 | */ |
| 646 | |
| 647 | footnotes: function () { |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 648 | // Delete existing footnote entries in case we're reloading the footnodes. |
| 649 | var i; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 650 | var noteholder = document.getElementById("footnotes"); |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 651 | if (!noteholder) { |
| 652 | return; |
| 653 | } |
| 654 | var entriesToRemove = []; |
| 655 | for (i = 0; i < noteholder.childNodes.length; i++) { |
| 656 | var entry = noteholder.childNodes[i]; |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 657 | if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote") |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 658 | entriesToRemove.push(entry); |
| 659 | } |
| 660 | for (i = 0; i < entriesToRemove.length; i++) { |
| 661 | noteholder.removeChild(entriesToRemove[i]); |
| 662 | } |
| 663 | |
| 664 | // Rebuild footnote entries. |
| 665 | var cont = document.getElementById("content"); |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 666 | var spans = cont.getElementsByTagName("span"); |
| 667 | var refs = {}; |
| 668 | var n = 0; |
| 669 | for (i=0; i<spans.length; i++) { |
| 670 | if (spans[i].className == "footnote") { |
| 671 | n++; |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 672 | var note = spans[i].getAttribute("data-note"); |
| 673 | if (!note) { |
| 674 | // Use [\s\S] in place of . so multi-line matches work. |
| 675 | // Because JavaScript has no s (dotall) regex flag. |
| 676 | note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1]; |
| 677 | spans[i].innerHTML = |
| 678 | "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n + |
| 679 | "' title='View footnote' class='footnote'>" + n + "</a>]"; |
| 680 | spans[i].setAttribute("data-note", note); |
| 681 | } |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 682 | noteholder.innerHTML += |
| 683 | "<div class='footnote' id='_footnote_" + n + "'>" + |
| 684 | "<a href='#_footnoteref_" + n + "' title='Return to text'>" + |
| 685 | n + "</a>. " + note + "</div>"; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 686 | var id =spans[i].getAttribute("id"); |
| 687 | if (id != null) refs["#"+id] = n; |
| 688 | } |
| 689 | } |
| 690 | if (n == 0) |
| 691 | noteholder.parentNode.removeChild(noteholder); |
| 692 | else { |
| 693 | // Process footnoterefs. |
| 694 | for (i=0; i<spans.length; i++) { |
| 695 | if (spans[i].className == "footnoteref") { |
| 696 | var href = spans[i].getElementsByTagName("a")[0].getAttribute("href"); |
| 697 | href = href.match(/#.*/)[0]; // Because IE return full URL. |
| 698 | n = refs[href]; |
| 699 | spans[i].innerHTML = |
| 700 | "[<a href='#_footnote_" + n + |
| 701 | "' title='View footnote' class='footnote'>" + n + "</a>]"; |
| 702 | } |
| 703 | } |
| 704 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 705 | }, |
| 706 | |
| 707 | install: function(toclevels) { |
| 708 | var timerId; |
| 709 | |
| 710 | function reinstall() { |
| 711 | asciidoc.footnotes(); |
| 712 | if (toclevels) { |
| 713 | asciidoc.toc(toclevels); |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | function reinstallAndRemoveTimer() { |
| 718 | clearInterval(timerId); |
| 719 | reinstall(); |
| 720 | } |
| 721 | |
| 722 | timerId = setInterval(reinstall, 500); |
| 723 | if (document.addEventListener) |
| 724 | document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false); |
| 725 | else |
| 726 | window.onload = reinstallAndRemoveTimer; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 727 | } |
| 728 | |
| 729 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 730 | asciidoc.install(); |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 731 | /*]]>*/ |
| 732 | </script> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 733 | </head> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 734 | <body class="manpage"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 735 | <div id="header"> |
| 736 | <h1> |
| 737 | git-rebase(1) Manual Page |
| 738 | </h1> |
| 739 | <h2>NAME</h2> |
| 740 | <div class="sectionbody"> |
| 741 | <p>git-rebase - |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 742 | Forward-port local commits to the updated upstream head |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 743 | </p> |
| 744 | </div> |
| 745 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 746 | <div id="content"> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 747 | <div class="sect1"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 748 | <h2 id="_synopsis">SYNOPSIS</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 749 | <div class="sectionbody"> |
Junio C Hamano | a9b8d24 | 2007-05-19 04:51:55 | [diff] [blame] | 750 | <div class="verseblock"> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 751 | <pre class="content"><em>git rebase</em> [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>] |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 752 | [<upstream> [<branch>]] |
Junio C Hamano | 0248269 | 2012-07-16 05:28:39 | [diff] [blame] | 753 | <em>git rebase</em> [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>] |
Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 754 | --root [<branch>] |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 755 | <em>git rebase</em> --continue | --skip | --abort | --edit-todo</pre> |
| 756 | <div class="attribution"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 757 | </div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 758 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 759 | </div> |
| 760 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 761 | <h2 id="_description">DESCRIPTION</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 762 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 763 | <div class="paragraph"><p>If <branch> is specified, <em>git rebase</em> will perform an automatic |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 764 | <code>git checkout <branch></code> before doing anything else. Otherwise |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 765 | it remains on the current branch.</p></div> |
Junio C Hamano | b02377c | 2011-04-28 22:26:02 | [diff] [blame] | 766 | <div class="paragraph"><p>If <upstream> is not specified, the upstream configured in |
Junio C Hamano | 9236fea | 2014-10-14 22:28:09 | [diff] [blame] | 767 | branch.<name>.remote and branch.<name>.merge options will be used (see |
| 768 | <a href="git-config.html">git-config(1)</a> for details) and the <code>--fork-point</code> option is |
| 769 | assumed. If you are currently not on any branch or if the current |
| 770 | branch does not have a configured upstream, the rebase will abort.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 771 | <div class="paragraph"><p>All changes made by commits in the current branch but that are not |
Junio C Hamano | 89d4e0f | 2007-02-18 00:34:59 | [diff] [blame] | 772 | in <upstream> are saved to a temporary area. This is the same set |
Junio C Hamano | 9236fea | 2014-10-14 22:28:09 | [diff] [blame] | 773 | of commits that would be shown by <code>git log <upstream>..HEAD</code>; or by |
| 774 | <code>git log 'fork_point'..HEAD</code>, if <code>--fork-point</code> is active (see the |
| 775 | description on <code>--fork-point</code> below); or by <code>git log HEAD</code>, if the |
| 776 | <code>--root</code> option is specified.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 777 | <div class="paragraph"><p>The current branch is reset to <upstream>, or <newbase> if the |
Junio C Hamano | 89d4e0f | 2007-02-18 00:34:59 | [diff] [blame] | 778 | --onto option was supplied. This has the exact same effect as |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 779 | <code>git reset --hard <upstream></code> (or <newbase>). ORIG_HEAD is set |
Junio C Hamano | 38ddcce | 2008-07-15 15:49:03 | [diff] [blame] | 780 | to point at the tip of the branch before the reset.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 781 | <div class="paragraph"><p>The commits that were previously saved into the temporary area are |
Junio C Hamano | 764a667 | 2007-10-23 01:23:31 | [diff] [blame] | 782 | then reapplied to the current branch, one by one, in order. Note that |
| 783 | any commits in HEAD which introduce the same textual changes as a commit |
| 784 | in HEAD..<upstream> are omitted (i.e., a patch already accepted upstream |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 785 | with a different commit message or timestamp will be skipped).</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 786 | <div class="paragraph"><p>It is possible that a merge failure will prevent this process from being |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 787 | completely automatic. You will have to resolve any such merge failure |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 788 | and run <code>git rebase --continue</code>. Another option is to bypass the commit |
| 789 | that caused the merge failure with <code>git rebase --skip</code>. To check out the |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 790 | original <branch> and remove the .git/rebase-apply working files, use the |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 791 | command <code>git rebase --abort</code> instead.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 792 | <div class="paragraph"><p>Assume the following history exists and the current branch is "topic":</p></div> |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 793 | <div class="listingblock"> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 794 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 795 | <pre><code> A---B---C topic |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 796 | / |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 797 | D---E---F---G master</code></pre> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 798 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 799 | <div class="paragraph"><p>From this point, the result of either of the following commands:</p></div> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 800 | <div class="literalblock"> |
| 801 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 802 | <pre><code>git rebase master |
| 803 | git rebase master topic</code></pre> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 804 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 805 | <div class="paragraph"><p>would be:</p></div> |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 806 | <div class="listingblock"> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 807 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 808 | <pre><code> A'--B'--C' topic |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 809 | / |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 810 | D---E---F---G master</code></pre> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 811 | </div></div> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 812 | <div class="paragraph"><p><strong>NOTE:</strong> The latter form is just a short-hand of <code>git checkout topic</code> |
| 813 | followed by <code>git rebase master</code>. When rebase exits <code>topic</code> will |
Junio C Hamano | 92faa80 | 2011-03-15 01:00:18 | [diff] [blame] | 814 | remain the checked-out branch.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 815 | <div class="paragraph"><p>If the upstream branch already contains a change you have made (e.g., |
Junio C Hamano | 764a667 | 2007-10-23 01:23:31 | [diff] [blame] | 816 | because you mailed a patch which was applied upstream), then that commit |
Junio C Hamano | 1dbca52 | 2015-05-22 20:48:55 | [diff] [blame] | 817 | will be skipped. For example, running <code>git rebase master</code> on the |
| 818 | following history (in which <code>A'</code> and <code>A</code> introduce the same set of changes, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 819 | but have different committer information):</p></div> |
Junio C Hamano | 764a667 | 2007-10-23 01:23:31 | [diff] [blame] | 820 | <div class="listingblock"> |
| 821 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 822 | <pre><code> A---B---C topic |
Junio C Hamano | 764a667 | 2007-10-23 01:23:31 | [diff] [blame] | 823 | / |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 824 | D---E---A'---F master</code></pre> |
Junio C Hamano | 764a667 | 2007-10-23 01:23:31 | [diff] [blame] | 825 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 826 | <div class="paragraph"><p>will result in:</p></div> |
Junio C Hamano | 764a667 | 2007-10-23 01:23:31 | [diff] [blame] | 827 | <div class="listingblock"> |
| 828 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 829 | <pre><code> B'---C' topic |
Junio C Hamano | 764a667 | 2007-10-23 01:23:31 | [diff] [blame] | 830 | / |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 831 | D---E---A'---F master</code></pre> |
Junio C Hamano | 764a667 | 2007-10-23 01:23:31 | [diff] [blame] | 832 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 833 | <div class="paragraph"><p>Here is how you would transplant a topic branch based on one |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 834 | branch to another, to pretend that you forked the topic branch |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 835 | from the latter branch, using <code>rebase --onto</code>.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 836 | <div class="paragraph"><p>First let’s assume your <em>topic</em> is based on branch <em>next</em>. |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 837 | For example, a feature developed in <em>topic</em> depends on some |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 838 | functionality which is found in <em>next</em>.</p></div> |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 839 | <div class="listingblock"> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 840 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 841 | <pre><code> o---o---o---o---o master |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 842 | \ |
| 843 | o---o---o---o---o next |
| 844 | \ |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 845 | o---o---o topic</code></pre> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 846 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 847 | <div class="paragraph"><p>We want to make <em>topic</em> forked from branch <em>master</em>; for example, |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 848 | because the functionality on which <em>topic</em> depends was merged into the |
| 849 | more stable <em>master</em> branch. We want our tree to look like this:</p></div> |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 850 | <div class="listingblock"> |
| 851 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 852 | <pre><code> o---o---o---o---o master |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 853 | | \ |
| 854 | | o'--o'--o' topic |
| 855 | \ |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 856 | o---o---o---o---o next</code></pre> |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 857 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 858 | <div class="paragraph"><p>We can get this using the following command:</p></div> |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 859 | <div class="literalblock"> |
| 860 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 861 | <pre><code>git rebase --onto master next topic</code></pre> |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 862 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 863 | <div class="paragraph"><p>Another example of --onto option is to rebase part of a |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 864 | branch. If we have the following situation:</p></div> |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 865 | <div class="listingblock"> |
| 866 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 867 | <pre><code> H---I---J topicB |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 868 | / |
| 869 | E---F---G topicA |
| 870 | / |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 871 | A---B---C---D master</code></pre> |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 872 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 873 | <div class="paragraph"><p>then the command</p></div> |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 874 | <div class="literalblock"> |
| 875 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 876 | <pre><code>git rebase --onto master topicA topicB</code></pre> |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 877 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 878 | <div class="paragraph"><p>would result in:</p></div> |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 879 | <div class="listingblock"> |
| 880 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 881 | <pre><code> H'--I'--J' topicB |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 882 | / |
| 883 | | E---F---G topicA |
| 884 | |/ |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 885 | A---B---C---D master</code></pre> |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 886 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 887 | <div class="paragraph"><p>This is useful when topicB does not depend on topicA.</p></div> |
| 888 | <div class="paragraph"><p>A range of commits could also be removed with rebase. If we have |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 889 | the following situation:</p></div> |
Junio C Hamano | 42f855f | 2007-02-06 00:09:38 | [diff] [blame] | 890 | <div class="listingblock"> |
| 891 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 892 | <pre><code> E---F---G---H---I---J topicA</code></pre> |
Junio C Hamano | 42f855f | 2007-02-06 00:09:38 | [diff] [blame] | 893 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 894 | <div class="paragraph"><p>then the command</p></div> |
Junio C Hamano | 42f855f | 2007-02-06 00:09:38 | [diff] [blame] | 895 | <div class="literalblock"> |
| 896 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 897 | <pre><code>git rebase --onto topicA~5 topicA~3 topicA</code></pre> |
Junio C Hamano | 42f855f | 2007-02-06 00:09:38 | [diff] [blame] | 898 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 899 | <div class="paragraph"><p>would result in the removal of commits F and G:</p></div> |
Junio C Hamano | 42f855f | 2007-02-06 00:09:38 | [diff] [blame] | 900 | <div class="listingblock"> |
| 901 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 902 | <pre><code> E---H'---I'---J' topicA</code></pre> |
Junio C Hamano | 42f855f | 2007-02-06 00:09:38 | [diff] [blame] | 903 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 904 | <div class="paragraph"><p>This is useful if F and G were flawed in some way, or should not be |
Junio C Hamano | 42f855f | 2007-02-06 00:09:38 | [diff] [blame] | 905 | part of topicA. Note that the argument to --onto and the <upstream> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 906 | parameter can be any valid commit-ish.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 907 | <div class="paragraph"><p>In case of conflict, <em>git rebase</em> will stop at the first problematic commit |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 908 | and leave conflict markers in the tree. You can use <em>git diff</em> to locate |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 909 | the markers (<<<<<<) and make edits to resolve the conflict. For each |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 910 | file you edit, you need to tell Git that the conflict has been resolved, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 911 | typically this would be done with</p></div> |
Junio C Hamano | f02e09f | 2006-03-27 07:51:03 | [diff] [blame] | 912 | <div class="literalblock"> |
| 913 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 914 | <pre><code>git add <filename></code></pre> |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 915 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 916 | <div class="paragraph"><p>After resolving the conflict manually and updating the index with the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 917 | desired resolution, you can continue the rebasing process with</p></div> |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 918 | <div class="literalblock"> |
| 919 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 920 | <pre><code>git rebase --continue</code></pre> |
Junio C Hamano | f02e09f | 2006-03-27 07:51:03 | [diff] [blame] | 921 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 922 | <div class="paragraph"><p>Alternatively, you can undo the <em>git rebase</em> with</p></div> |
Junio C Hamano | f02e09f | 2006-03-27 07:51:03 | [diff] [blame] | 923 | <div class="literalblock"> |
| 924 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 925 | <pre><code>git rebase --abort</code></pre> |
Junio C Hamano | f02e09f | 2006-03-27 07:51:03 | [diff] [blame] | 926 | </div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 927 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 928 | </div> |
| 929 | <div class="sect1"> |
Junio C Hamano | ea6a764 | 2009-03-11 23:56:19 | [diff] [blame] | 930 | <h2 id="_configuration">CONFIGURATION</h2> |
| 931 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 932 | <div class="dlist"><dl> |
| 933 | <dt class="hdlist1"> |
Junio C Hamano | ea6a764 | 2009-03-11 23:56:19 | [diff] [blame] | 934 | rebase.stat |
| 935 | </dt> |
| 936 | <dd> |
| 937 | <p> |
| 938 | Whether to show a diffstat of what changed upstream since the last |
| 939 | rebase. False by default. |
| 940 | </p> |
| 941 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 942 | <dt class="hdlist1"> |
Junio C Hamano | 322c624 | 2015-03-23 21:32:46 | [diff] [blame] | 943 | rebase.autoSquash |
Junio C Hamano | 075ae87 | 2010-09-01 18:43:07 | [diff] [blame] | 944 | </dt> |
| 945 | <dd> |
| 946 | <p> |
| 947 | If set to true enable <em>--autosquash</em> option by default. |
| 948 | </p> |
| 949 | </dd> |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 950 | <dt class="hdlist1"> |
Junio C Hamano | 322c624 | 2015-03-23 21:32:46 | [diff] [blame] | 951 | rebase.autoStash |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 952 | </dt> |
| 953 | <dd> |
| 954 | <p> |
| 955 | If set to true enable <em>--autostash</em> option by default. |
| 956 | </p> |
| 957 | </dd> |
Junio C Hamano | d7ed404 | 2015-08-03 19:43:00 | [diff] [blame] | 958 | <dt class="hdlist1"> |
| 959 | rebase.missingCommitsCheck |
| 960 | </dt> |
| 961 | <dd> |
| 962 | <p> |
| 963 | If set to "warn", print warnings about removed commits in |
| 964 | interactive mode. If set to "error", print the warnings and |
| 965 | stop the rebase. If set to "ignore", no checking is |
| 966 | done. "ignore" by default. |
| 967 | </p> |
| 968 | </dd> |
| 969 | <dt class="hdlist1"> |
| 970 | rebase.instructionFormat |
| 971 | </dt> |
| 972 | <dd> |
| 973 | <p> |
| 974 | Custom commit list format to use during an <em>--interactive</em> rebase. |
| 975 | </p> |
| 976 | </dd> |
Junio C Hamano | ea6a764 | 2009-03-11 23:56:19 | [diff] [blame] | 977 | </dl></div> |
| 978 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 979 | </div> |
| 980 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 981 | <h2 id="_options">OPTIONS</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 982 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 983 | <div class="dlist"><dl> |
| 984 | <dt class="hdlist1"> |
Junio C Hamano | 644936c | 2012-06-28 23:05:14 | [diff] [blame] | 985 | --onto <newbase> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 986 | </dt> |
| 987 | <dd> |
| 988 | <p> |
| 989 | Starting point at which to create the new commits. If the |
| 990 | --onto option is not specified, the starting point is |
Junio C Hamano | 42f855f | 2007-02-06 00:09:38 | [diff] [blame] | 991 | <upstream>. May be any valid commit, and not just an |
| 992 | existing branch name. |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 993 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 994 | <div class="paragraph"><p>As a special case, you may use "A...B" as a shortcut for the |
Junio C Hamano | e32ec8b | 2010-06-02 23:32:31 | [diff] [blame] | 995 | merge base of A and B if there is exactly one merge base. You can |
| 996 | leave out at most one of A and B, in which case it defaults to HEAD.</p></div> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 997 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 998 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 999 | <upstream> |
| 1000 | </dt> |
| 1001 | <dd> |
| 1002 | <p> |
Junio C Hamano | 42f855f | 2007-02-06 00:09:38 | [diff] [blame] | 1003 | Upstream branch to compare against. May be any valid commit, |
Junio C Hamano | b02377c | 2011-04-28 22:26:02 | [diff] [blame] | 1004 | not just an existing branch name. Defaults to the configured |
| 1005 | upstream for the current branch. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1006 | </p> |
| 1007 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1008 | <dt class="hdlist1"> |
Junio C Hamano | 2b13527 | 2006-03-18 07:45:42 | [diff] [blame] | 1009 | <branch> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1010 | </dt> |
| 1011 | <dd> |
| 1012 | <p> |
| 1013 | Working branch; defaults to HEAD. |
| 1014 | </p> |
| 1015 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1016 | <dt class="hdlist1"> |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 1017 | --continue |
| 1018 | </dt> |
| 1019 | <dd> |
| 1020 | <p> |
| 1021 | Restart the rebasing process after having resolved a merge conflict. |
| 1022 | </p> |
| 1023 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1024 | <dt class="hdlist1"> |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 1025 | --abort |
| 1026 | </dt> |
| 1027 | <dd> |
| 1028 | <p> |
Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 1029 | Abort the rebase operation and reset HEAD to the original |
| 1030 | branch. If <branch> was provided when the rebase operation was |
| 1031 | started, then HEAD will be reset to <branch>. Otherwise HEAD |
| 1032 | will be reset to where it was when the rebase operation was |
| 1033 | started. |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 1034 | </p> |
| 1035 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1036 | <dt class="hdlist1"> |
Junio C Hamano | 37e389e | 2012-04-30 22:36:09 | [diff] [blame] | 1037 | --keep-empty |
| 1038 | </dt> |
| 1039 | <dd> |
| 1040 | <p> |
| 1041 | Keep the commits that do not change anything from its |
| 1042 | parents in the result. |
| 1043 | </p> |
| 1044 | </dd> |
| 1045 | <dt class="hdlist1"> |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1046 | --skip |
| 1047 | </dt> |
| 1048 | <dd> |
| 1049 | <p> |
| 1050 | Restart the rebasing process by skipping the current patch. |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1051 | </p> |
| 1052 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1053 | <dt class="hdlist1"> |
Junio C Hamano | 9cdfecf | 2012-09-30 07:38:36 | [diff] [blame] | 1054 | --edit-todo |
| 1055 | </dt> |
| 1056 | <dd> |
| 1057 | <p> |
| 1058 | Edit the todo list during an interactive rebase. |
| 1059 | </p> |
| 1060 | </dd> |
| 1061 | <dt class="hdlist1"> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 1062 | -m |
| 1063 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1064 | <dt class="hdlist1"> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 1065 | --merge |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1066 | </dt> |
| 1067 | <dd> |
| 1068 | <p> |
| 1069 | Use merging strategies to rebase. When the recursive (default) merge |
| 1070 | strategy is used, this allows rebase to be aware of renames on the |
| 1071 | upstream side. |
| 1072 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1073 | <div class="paragraph"><p>Note that a rebase merge works by replaying each commit from the working |
Junio C Hamano | bf984de | 2009-11-23 06:11:19 | [diff] [blame] | 1074 | branch on top of the <upstream> branch. Because of this, when a merge |
| 1075 | conflict happens, the side reported as <em>ours</em> is the so-far rebased |
| 1076 | series, starting with <upstream>, and <em>theirs</em> is the working branch. In |
| 1077 | other words, the sides are swapped.</p></div> |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1078 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1079 | <dt class="hdlist1"> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 1080 | -s <strategy> |
| 1081 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1082 | <dt class="hdlist1"> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 1083 | --strategy=<strategy> |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1084 | </dt> |
| 1085 | <dd> |
| 1086 | <p> |
Junio C Hamano | 52d5def | 2009-05-21 16:27:43 | [diff] [blame] | 1087 | Use the given merge strategy. |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1088 | If there is no <code>-s</code> option <em>git merge-recursive</em> is used |
Junio C Hamano | bf984de | 2009-11-23 06:11:19 | [diff] [blame] | 1089 | instead. This implies --merge. |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1090 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1091 | <div class="paragraph"><p>Because <em>git rebase</em> replays each commit from the working branch |
Junio C Hamano | bf984de | 2009-11-23 06:11:19 | [diff] [blame] | 1092 | on top of the <upstream> branch using the given strategy, using |
| 1093 | the <em>ours</em> strategy simply discards all patches from the <branch>, |
| 1094 | which makes little sense.</p></div> |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1095 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1096 | <dt class="hdlist1"> |
Junio C Hamano | 619596a | 2010-08-18 22:15:35 | [diff] [blame] | 1097 | -X <strategy-option> |
| 1098 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1099 | <dt class="hdlist1"> |
Junio C Hamano | 619596a | 2010-08-18 22:15:35 | [diff] [blame] | 1100 | --strategy-option=<strategy-option> |
| 1101 | </dt> |
| 1102 | <dd> |
| 1103 | <p> |
| 1104 | Pass the <strategy-option> through to the merge strategy. |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1105 | This implies <code>--merge</code> and, if no strategy has been |
| 1106 | specified, <code>-s recursive</code>. Note the reversal of <em>ours</em> and |
| 1107 | <em>theirs</em> as noted above for the <code>-m</code> option. |
Junio C Hamano | 619596a | 2010-08-18 22:15:35 | [diff] [blame] | 1108 | </p> |
| 1109 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1110 | <dt class="hdlist1"> |
Junio C Hamano | 5b3533d | 2014-02-27 23:07:15 | [diff] [blame] | 1111 | -S[<keyid>] |
| 1112 | </dt> |
| 1113 | <dt class="hdlist1"> |
| 1114 | --gpg-sign[=<keyid>] |
| 1115 | </dt> |
| 1116 | <dd> |
| 1117 | <p> |
Junio C Hamano | 1eb5609 | 2015-10-05 20:39:53 | [diff] [blame] | 1118 | GPG-sign commits. The <code>keyid</code> argument is optional and |
| 1119 | defaults to the committer identity; if specified, it must be |
| 1120 | stuck to the option without a space. |
Junio C Hamano | 5b3533d | 2014-02-27 23:07:15 | [diff] [blame] | 1121 | </p> |
| 1122 | </dd> |
| 1123 | <dt class="hdlist1"> |
Junio C Hamano | 2c14c8d | 2009-07-02 03:17:00 | [diff] [blame] | 1124 | -q |
| 1125 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1126 | <dt class="hdlist1"> |
Junio C Hamano | 2c14c8d | 2009-07-02 03:17:00 | [diff] [blame] | 1127 | --quiet |
| 1128 | </dt> |
| 1129 | <dd> |
| 1130 | <p> |
| 1131 | Be quiet. Implies --no-stat. |
| 1132 | </p> |
| 1133 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1134 | <dt class="hdlist1"> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 1135 | -v |
| 1136 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1137 | <dt class="hdlist1"> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 1138 | --verbose |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 1139 | </dt> |
| 1140 | <dd> |
| 1141 | <p> |
Junio C Hamano | ea6a764 | 2009-03-11 23:56:19 | [diff] [blame] | 1142 | Be verbose. Implies --stat. |
| 1143 | </p> |
| 1144 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1145 | <dt class="hdlist1"> |
Junio C Hamano | ea6a764 | 2009-03-11 23:56:19 | [diff] [blame] | 1146 | --stat |
| 1147 | </dt> |
| 1148 | <dd> |
| 1149 | <p> |
| 1150 | Show a diffstat of what changed upstream since the last rebase. The |
| 1151 | diffstat is also controlled by the configuration option rebase.stat. |
| 1152 | </p> |
| 1153 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1154 | <dt class="hdlist1"> |
Junio C Hamano | ea6a764 | 2009-03-11 23:56:19 | [diff] [blame] | 1155 | -n |
| 1156 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1157 | <dt class="hdlist1"> |
Junio C Hamano | ea6a764 | 2009-03-11 23:56:19 | [diff] [blame] | 1158 | --no-stat |
| 1159 | </dt> |
| 1160 | <dd> |
| 1161 | <p> |
| 1162 | Do not show a diffstat as part of the rebase process. |
Junio C Hamano | fbe0052 | 2006-10-19 05:58:48 | [diff] [blame] | 1163 | </p> |
| 1164 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1165 | <dt class="hdlist1"> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1166 | --no-verify |
| 1167 | </dt> |
| 1168 | <dd> |
| 1169 | <p> |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1170 | This option bypasses the pre-rebase hook. See also <a href="githooks.html">githooks(5)</a>. |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1171 | </p> |
| 1172 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1173 | <dt class="hdlist1"> |
Junio C Hamano | eef01fe | 2010-12-13 08:31:58 | [diff] [blame] | 1174 | --verify |
| 1175 | </dt> |
| 1176 | <dd> |
| 1177 | <p> |
| 1178 | Allows the pre-rebase hook to run, which is the default. This option can |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1179 | be used to override --no-verify. See also <a href="githooks.html">githooks(5)</a>. |
Junio C Hamano | eef01fe | 2010-12-13 08:31:58 | [diff] [blame] | 1180 | </p> |
| 1181 | </dd> |
| 1182 | <dt class="hdlist1"> |
Junio C Hamano | d333998 | 2007-02-09 08:38:48 | [diff] [blame] | 1183 | -C<n> |
| 1184 | </dt> |
| 1185 | <dd> |
| 1186 | <p> |
| 1187 | Ensure at least <n> lines of surrounding context match before |
| 1188 | and after each change. When fewer lines of surrounding |
| 1189 | context exist they all must match. By default no context is |
| 1190 | ever ignored. |
| 1191 | </p> |
| 1192 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1193 | <dt class="hdlist1"> |
Junio C Hamano | a973f1c | 2009-03-19 17:47:52 | [diff] [blame] | 1194 | -f |
| 1195 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1196 | <dt class="hdlist1"> |
Junio C Hamano | a973f1c | 2009-03-19 17:47:52 | [diff] [blame] | 1197 | --force-rebase |
| 1198 | </dt> |
| 1199 | <dd> |
| 1200 | <p> |
Junio C Hamano | 53fe031 | 2014-09-09 21:16:17 | [diff] [blame] | 1201 | Force a rebase even if the current branch is up-to-date and |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1202 | the command without <code>--force</code> would return without doing anything. |
Junio C Hamano | a973f1c | 2009-03-19 17:47:52 | [diff] [blame] | 1203 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1204 | <div class="paragraph"><p>You may find this (or --no-ff with an interactive rebase) helpful after |
Junio C Hamano | ef8fbf9 | 2010-04-04 19:12:02 | [diff] [blame] | 1205 | reverting a topic branch merge, as this option recreates the topic branch with |
| 1206 | fresh commits so it can be remerged successfully without needing to "revert |
| 1207 | the reversion" (see the |
Junio C Hamano | e6f28d0 | 2013-09-17 21:34:00 | [diff] [blame] | 1208 | <a href="howto/revert-a-faulty-merge.html">revert-a-faulty-merge How-To</a> for details).</p></div> |
Junio C Hamano | a973f1c | 2009-03-19 17:47:52 | [diff] [blame] | 1209 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1210 | <dt class="hdlist1"> |
Junio C Hamano | b1acf02 | 2013-12-28 00:33:16 | [diff] [blame] | 1211 | --fork-point |
| 1212 | </dt> |
| 1213 | <dt class="hdlist1"> |
| 1214 | --no-fork-point |
| 1215 | </dt> |
| 1216 | <dd> |
| 1217 | <p> |
Junio C Hamano | 9236fea | 2014-10-14 22:28:09 | [diff] [blame] | 1218 | Use reflog to find a better common ancestor between <upstream> |
| 1219 | and <branch> when calculating which commits have been |
| 1220 | introduced by <branch>. |
Junio C Hamano | b1acf02 | 2013-12-28 00:33:16 | [diff] [blame] | 1221 | </p> |
Junio C Hamano | 9236fea | 2014-10-14 22:28:09 | [diff] [blame] | 1222 | <div class="paragraph"><p>When --fork-point is active, <em>fork_point</em> will be used instead of |
| 1223 | <upstream> to calculate the set of commits to rebase, where |
| 1224 | <em>fork_point</em> is the result of <code>git merge-base --fork-point <upstream> |
| 1225 | <branch></code> command (see <a href="git-merge-base.html">git-merge-base(1)</a>). If <em>fork_point</em> |
| 1226 | ends up being empty, the <upstream> will be used as a fallback.</p></div> |
| 1227 | <div class="paragraph"><p>If either <upstream> or --root is given on the command line, then the |
| 1228 | default is <code>--no-fork-point</code>, otherwise the default is <code>--fork-point</code>.</p></div> |
Junio C Hamano | b1acf02 | 2013-12-28 00:33:16 | [diff] [blame] | 1229 | </dd> |
| 1230 | <dt class="hdlist1"> |
Junio C Hamano | fe24db0 | 2009-08-22 05:10:47 | [diff] [blame] | 1231 | --ignore-whitespace |
| 1232 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1233 | <dt class="hdlist1"> |
Junio C Hamano | f8a7922 | 2009-03-01 08:02:50 | [diff] [blame] | 1234 | --whitespace=<option> |
Junio C Hamano | 250f03e | 2007-09-10 01:33:28 | [diff] [blame] | 1235 | </dt> |
| 1236 | <dd> |
| 1237 | <p> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1238 | These flag are passed to the <em>git apply</em> program |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1239 | (see <a href="git-apply.html">git-apply(1)</a>) that applies the patch. |
Junio C Hamano | ec3b9a7 | 2009-02-13 08:45:52 | [diff] [blame] | 1240 | Incompatible with the --interactive option. |
Junio C Hamano | 250f03e | 2007-09-10 01:33:28 | [diff] [blame] | 1241 | </p> |
| 1242 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1243 | <dt class="hdlist1"> |
Junio C Hamano | a973f1c | 2009-03-19 17:47:52 | [diff] [blame] | 1244 | --committer-date-is-author-date |
| 1245 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1246 | <dt class="hdlist1"> |
Junio C Hamano | a973f1c | 2009-03-19 17:47:52 | [diff] [blame] | 1247 | --ignore-date |
| 1248 | </dt> |
| 1249 | <dd> |
| 1250 | <p> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1251 | These flags are passed to <em>git am</em> to easily change the dates |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1252 | of the rebased commits (see <a href="git-am.html">git-am(1)</a>). |
Junio C Hamano | e97d577 | 2010-05-19 08:13:58 | [diff] [blame] | 1253 | Incompatible with the --interactive option. |
Junio C Hamano | a973f1c | 2009-03-19 17:47:52 | [diff] [blame] | 1254 | </p> |
| 1255 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1256 | <dt class="hdlist1"> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 1257 | -i |
| 1258 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1259 | <dt class="hdlist1"> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 1260 | --interactive |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1261 | </dt> |
| 1262 | <dd> |
| 1263 | <p> |
| 1264 | Make a list of the commits which are about to be rebased. Let the |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 1265 | user edit that list before rebasing. This mode can also be used to |
| 1266 | split commits (see SPLITTING COMMITS below). |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1267 | </p> |
Junio C Hamano | d7ed404 | 2015-08-03 19:43:00 | [diff] [blame] | 1268 | <div class="paragraph"><p>The commit list format can be changed by setting the configuration option |
| 1269 | rebase.instructionFormat. A customized instruction format will automatically |
| 1270 | have the long commit hash prepended to the format.</p></div> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1271 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1272 | <dt class="hdlist1"> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 1273 | -p |
| 1274 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1275 | <dt class="hdlist1"> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 1276 | --preserve-merges |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1277 | </dt> |
| 1278 | <dd> |
| 1279 | <p> |
Junio C Hamano | 8ea9ba9 | 2015-04-02 21:08:50 | [diff] [blame] | 1280 | Recreate merge commits instead of flattening the history by replaying |
| 1281 | commits a merge commit introduces. Merge conflict resolutions or manual |
| 1282 | amendments to merge commits are not preserved. |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1283 | </p> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1284 | <div class="paragraph"><p>This uses the <code>--interactive</code> machinery internally, but combining it |
| 1285 | with the <code>--interactive</code> option explicitly is generally not a good |
Junio C Hamano | bb88cf4 | 2010-06-21 15:23:55 | [diff] [blame] | 1286 | idea unless you know what you are doing (see BUGS below).</p></div> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1287 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1288 | <dt class="hdlist1"> |
Junio C Hamano | 644936c | 2012-06-28 23:05:14 | [diff] [blame] | 1289 | -x <cmd> |
| 1290 | </dt> |
| 1291 | <dt class="hdlist1"> |
| 1292 | --exec <cmd> |
| 1293 | </dt> |
| 1294 | <dd> |
| 1295 | <p> |
| 1296 | Append "exec <cmd>" after each line creating a commit in the |
| 1297 | final history. <cmd> will be interpreted as one or more shell |
| 1298 | commands. |
| 1299 | </p> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1300 | <div class="paragraph"><p>This option can only be used with the <code>--interactive</code> option |
Junio C Hamano | 644936c | 2012-06-28 23:05:14 | [diff] [blame] | 1301 | (see INTERACTIVE MODE below).</p></div> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1302 | <div class="paragraph"><p>You may execute several commands by either using one instance of <code>--exec</code> |
Junio C Hamano | 644936c | 2012-06-28 23:05:14 | [diff] [blame] | 1303 | with several commands:</p></div> |
| 1304 | <div class="literalblock"> |
| 1305 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1306 | <pre><code>git rebase -i --exec "cmd1 && cmd2 && ..."</code></pre> |
Junio C Hamano | 644936c | 2012-06-28 23:05:14 | [diff] [blame] | 1307 | </div></div> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1308 | <div class="paragraph"><p>or by giving more than one <code>--exec</code>:</p></div> |
Junio C Hamano | 644936c | 2012-06-28 23:05:14 | [diff] [blame] | 1309 | <div class="literalblock"> |
| 1310 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1311 | <pre><code>git rebase -i --exec "cmd1" --exec "cmd2" --exec ...</code></pre> |
Junio C Hamano | 644936c | 2012-06-28 23:05:14 | [diff] [blame] | 1312 | </div></div> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1313 | <div class="paragraph"><p>If <code>--autosquash</code> is used, "exec" lines will not be appended for |
Junio C Hamano | 644936c | 2012-06-28 23:05:14 | [diff] [blame] | 1314 | the intermediate commits, and will only appear at the end of each |
| 1315 | squash/fixup series.</p></div> |
| 1316 | </dd> |
| 1317 | <dt class="hdlist1"> |
Junio C Hamano | bd53dbf | 2009-01-18 18:26:37 | [diff] [blame] | 1318 | --root |
| 1319 | </dt> |
| 1320 | <dd> |
| 1321 | <p> |
| 1322 | Rebase all commits reachable from <branch>, instead of |
| 1323 | limiting them with an <upstream>. This allows you to rebase |
Junio C Hamano | 0248269 | 2012-07-16 05:28:39 | [diff] [blame] | 1324 | the root commit(s) on a branch. When used with --onto, it |
Junio C Hamano | bd53dbf | 2009-01-18 18:26:37 | [diff] [blame] | 1325 | will skip changes already contained in <newbase> (instead of |
Junio C Hamano | 0248269 | 2012-07-16 05:28:39 | [diff] [blame] | 1326 | <upstream>) whereas without --onto it will operate on every change. |
| 1327 | When used together with both --onto and --preserve-merges, |
| 1328 | <em>all</em> root commits will be rewritten to have <newbase> as parent |
Junio C Hamano | bd53dbf | 2009-01-18 18:26:37 | [diff] [blame] | 1329 | instead. |
| 1330 | </p> |
| 1331 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1332 | <dt class="hdlist1"> |
Junio C Hamano | a9701f0 | 2010-01-21 00:42:16 | [diff] [blame] | 1333 | --autosquash |
| 1334 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1335 | <dt class="hdlist1"> |
Junio C Hamano | 075ae87 | 2010-09-01 18:43:07 | [diff] [blame] | 1336 | --no-autosquash |
| 1337 | </dt> |
Junio C Hamano | a9701f0 | 2010-01-21 00:42:16 | [diff] [blame] | 1338 | <dd> |
| 1339 | <p> |
| 1340 | When the commit log message begins with "squash! …" (or |
| 1341 | "fixup! …"), and there is a commit whose title begins with |
| 1342 | the same …, automatically modify the todo list of rebase -i |
Junio C Hamano | 364b6a4 | 2010-01-22 07:57:59 | [diff] [blame] | 1343 | so that the commit marked for squashing comes right after the |
Junio C Hamano | a9701f0 | 2010-01-21 00:42:16 | [diff] [blame] | 1344 | commit to be modified, and change the action of the moved |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1345 | commit from <code>pick</code> to <code>squash</code> (or <code>fixup</code>). Ignores subsequent |
Junio C Hamano | a195230 | 2013-07-01 21:31:18 | [diff] [blame] | 1346 | "fixup! " or "squash! " after the first, in case you referred to an |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1347 | earlier fixup/squash with <code>git commit --fixup/--squash</code>. |
Junio C Hamano | a9701f0 | 2010-01-21 00:42:16 | [diff] [blame] | 1348 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1349 | <div class="paragraph"><p>This option is only valid when the <em>--interactive</em> option is used.</p></div> |
| 1350 | <div class="paragraph"><p>If the <em>--autosquash</em> option is enabled by default using the |
Junio C Hamano | 322c624 | 2015-03-23 21:32:46 | [diff] [blame] | 1351 | configuration variable <code>rebase.autoSquash</code>, this option can be |
Junio C Hamano | 075ae87 | 2010-09-01 18:43:07 | [diff] [blame] | 1352 | used to override and disable this setting.</p></div> |
Junio C Hamano | ef8fbf9 | 2010-04-04 19:12:02 | [diff] [blame] | 1353 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1354 | <dt class="hdlist1"> |
Junio C Hamano | 1eb5609 | 2015-10-05 20:39:53 | [diff] [blame] | 1355 | --autostash |
| 1356 | </dt> |
| 1357 | <dt class="hdlist1"> |
| 1358 | --no-autostash |
Junio C Hamano | f1f5a7b | 2013-06-11 22:23:52 | [diff] [blame] | 1359 | </dt> |
| 1360 | <dd> |
| 1361 | <p> |
| 1362 | Automatically create a temporary stash before the operation |
| 1363 | begins, and apply it after the operation ends. This means |
| 1364 | that you can run rebase on a dirty worktree. However, use |
| 1365 | with care: the final stash application after a successful |
| 1366 | rebase might result in non-trivial conflicts. |
| 1367 | </p> |
| 1368 | </dd> |
| 1369 | <dt class="hdlist1"> |
Junio C Hamano | ef8fbf9 | 2010-04-04 19:12:02 | [diff] [blame] | 1370 | --no-ff |
| 1371 | </dt> |
| 1372 | <dd> |
| 1373 | <p> |
| 1374 | With --interactive, cherry-pick all rebased commits instead of |
| 1375 | fast-forwarding over the unchanged ones. This ensures that the |
| 1376 | entire history of the rebased branch is composed of new commits. |
| 1377 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1378 | <div class="paragraph"><p>Without --interactive, this is a synonym for --force-rebase.</p></div> |
| 1379 | <div class="paragraph"><p>You may find this helpful after reverting a topic branch merge, as this option |
Junio C Hamano | ef8fbf9 | 2010-04-04 19:12:02 | [diff] [blame] | 1380 | recreates the topic branch with fresh commits so it can be remerged |
| 1381 | successfully without needing to "revert the reversion" (see the |
Junio C Hamano | e6f28d0 | 2013-09-17 21:34:00 | [diff] [blame] | 1382 | <a href="howto/revert-a-faulty-merge.html">revert-a-faulty-merge How-To</a> for details).</p></div> |
Junio C Hamano | a9701f0 | 2010-01-21 00:42:16 | [diff] [blame] | 1383 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1384 | </dl></div> |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1385 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1386 | </div> |
| 1387 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1388 | <h2 id="_merge_strategies">MERGE STRATEGIES</h2> |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1389 | <div class="sectionbody"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1390 | <div class="paragraph"><p>The merge mechanism (<code>git merge</code> and <code>git pull</code> commands) allows the |
| 1391 | backend <em>merge strategies</em> to be chosen with <code>-s</code> option. Some strategies |
| 1392 | can also take their own options, which can be passed by giving <code>-X<option></code> |
| 1393 | arguments to <code>git merge</code> and/or <code>git pull</code>.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1394 | <div class="dlist"><dl> |
| 1395 | <dt class="hdlist1"> |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1396 | resolve |
| 1397 | </dt> |
| 1398 | <dd> |
| 1399 | <p> |
| 1400 | This can only resolve two heads (i.e. the current branch |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 1401 | and another branch you pulled from) using a 3-way merge |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1402 | algorithm. It tries to carefully detect criss-cross |
| 1403 | merge ambiguities and is considered generally safe and |
| 1404 | fast. |
| 1405 | </p> |
| 1406 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1407 | <dt class="hdlist1"> |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1408 | recursive |
| 1409 | </dt> |
| 1410 | <dd> |
| 1411 | <p> |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 1412 | This can only resolve two heads using a 3-way merge |
| 1413 | algorithm. When there is more than one common |
| 1414 | ancestor that can be used for 3-way merge, it creates a |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1415 | merged tree of the common ancestors and uses that as |
| 1416 | the reference tree for the 3-way merge. This has been |
| 1417 | reported to result in fewer merge conflicts without |
Junio C Hamano | 5b3533d | 2014-02-27 23:07:15 | [diff] [blame] | 1418 | causing mismerges by tests done on actual merge commits |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1419 | taken from Linux 2.6 kernel development history. |
| 1420 | Additionally this can detect and handle merges involving |
| 1421 | renames. This is the default merge strategy when |
| 1422 | pulling or merging one branch. |
| 1423 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1424 | <div class="paragraph"><p>The <em>recursive</em> strategy can take the following options:</p></div> |
| 1425 | <div class="dlist"><dl> |
| 1426 | <dt class="hdlist1"> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1427 | ours |
| 1428 | </dt> |
| 1429 | <dd> |
| 1430 | <p> |
| 1431 | This option forces conflicting hunks to be auto-resolved cleanly by |
| 1432 | favoring <em>our</em> version. Changes from the other tree that do not |
| 1433 | conflict with our side are reflected to the merge result. |
Junio C Hamano | a3cfb76 | 2012-09-15 05:32:14 | [diff] [blame] | 1434 | For a binary file, the entire contents are taken from our side. |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1435 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1436 | <div class="paragraph"><p>This should not be confused with the <em>ours</em> merge strategy, which does not |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1437 | even look at what the other tree contains at all. It discards everything |
| 1438 | the other tree did, declaring <em>our</em> history contains all that happened in it.</p></div> |
| 1439 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1440 | <dt class="hdlist1"> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1441 | theirs |
| 1442 | </dt> |
| 1443 | <dd> |
| 1444 | <p> |
Junio C Hamano | a3cfb76 | 2012-09-15 05:32:14 | [diff] [blame] | 1445 | This is the opposite of <em>ours</em>. |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1446 | </p> |
| 1447 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1448 | <dt class="hdlist1"> |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1449 | patience |
| 1450 | </dt> |
| 1451 | <dd> |
| 1452 | <p> |
| 1453 | With this option, <em>merge-recursive</em> spends a little extra time |
| 1454 | to avoid mismerges that sometimes occur due to unimportant |
| 1455 | matching lines (e.g., braces from distinct functions). Use |
| 1456 | this when the branches to be merged have diverged wildly. |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1457 | See also <a href="git-diff.html">git-diff(1)</a> <code>--patience</code>. |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1458 | </p> |
| 1459 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1460 | <dt class="hdlist1"> |
Junio C Hamano | 1575c20 | 2013-04-15 20:25:59 | [diff] [blame] | 1461 | diff-algorithm=[patience|minimal|histogram|myers] |
| 1462 | </dt> |
| 1463 | <dd> |
| 1464 | <p> |
| 1465 | Tells <em>merge-recursive</em> to use a different diff algorithm, which |
| 1466 | can help avoid mismerges that occur due to unimportant matching |
| 1467 | lines (such as braces from distinct functions). See also |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1468 | <a href="git-diff.html">git-diff(1)</a> <code>--diff-algorithm</code>. |
Junio C Hamano | 1575c20 | 2013-04-15 20:25:59 | [diff] [blame] | 1469 | </p> |
| 1470 | </dd> |
| 1471 | <dt class="hdlist1"> |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1472 | ignore-space-change |
| 1473 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1474 | <dt class="hdlist1"> |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1475 | ignore-all-space |
| 1476 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1477 | <dt class="hdlist1"> |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1478 | ignore-space-at-eol |
| 1479 | </dt> |
| 1480 | <dd> |
| 1481 | <p> |
| 1482 | Treats lines with the indicated type of whitespace change as |
| 1483 | unchanged for the sake of a three-way merge. Whitespace |
| 1484 | changes mixed with other changes to a line are not ignored. |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1485 | See also <a href="git-diff.html">git-diff(1)</a> <code>-b</code>, <code>-w</code>, and |
| 1486 | <code>--ignore-space-at-eol</code>. |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1487 | </p> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1488 | <div class="ulist"><ul> |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1489 | <li> |
| 1490 | <p> |
| 1491 | If <em>their</em> version only introduces whitespace changes to a line, |
| 1492 | <em>our</em> version is used; |
| 1493 | </p> |
| 1494 | </li> |
| 1495 | <li> |
| 1496 | <p> |
| 1497 | If <em>our</em> version introduces whitespace changes but <em>their</em> |
| 1498 | version includes a substantial change, <em>their</em> version is used; |
| 1499 | </p> |
| 1500 | </li> |
| 1501 | <li> |
| 1502 | <p> |
| 1503 | Otherwise, the merge proceeds in the usual way. |
| 1504 | </p> |
| 1505 | </li> |
| 1506 | </ul></div> |
| 1507 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1508 | <dt class="hdlist1"> |
Junio C Hamano | 2db3e75 | 2010-09-03 21:33:06 | [diff] [blame] | 1509 | renormalize |
| 1510 | </dt> |
| 1511 | <dd> |
| 1512 | <p> |
| 1513 | This runs a virtual check-out and check-in of all three stages |
| 1514 | of a file when resolving a three-way merge. This option is |
| 1515 | meant to be used when merging branches with different clean |
| 1516 | filters or end-of-line normalization rules. See "Merging |
| 1517 | branches with differing checkin/checkout attributes" in |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1518 | <a href="gitattributes.html">gitattributes(5)</a> for details. |
Junio C Hamano | 2db3e75 | 2010-09-03 21:33:06 | [diff] [blame] | 1519 | </p> |
| 1520 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1521 | <dt class="hdlist1"> |
Junio C Hamano | 2db3e75 | 2010-09-03 21:33:06 | [diff] [blame] | 1522 | no-renormalize |
| 1523 | </dt> |
| 1524 | <dd> |
| 1525 | <p> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1526 | Disables the <code>renormalize</code> option. This overrides the |
| 1527 | <code>merge.renormalize</code> configuration variable. |
Junio C Hamano | 2db3e75 | 2010-09-03 21:33:06 | [diff] [blame] | 1528 | </p> |
| 1529 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1530 | <dt class="hdlist1"> |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1531 | rename-threshold=<n> |
| 1532 | </dt> |
| 1533 | <dd> |
| 1534 | <p> |
| 1535 | Controls the similarity threshold used for rename detection. |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1536 | See also <a href="git-diff.html">git-diff(1)</a> <code>-M</code>. |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 1537 | </p> |
| 1538 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1539 | <dt class="hdlist1"> |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 1540 | subtree[=<path>] |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1541 | </dt> |
| 1542 | <dd> |
| 1543 | <p> |
| 1544 | This option is a more advanced form of <em>subtree</em> strategy, where |
| 1545 | the strategy makes a guess on how two trees must be shifted to |
| 1546 | match with each other when merging. Instead, the specified path |
| 1547 | is prefixed (or stripped from the beginning) to make the shape of |
| 1548 | two trees to match. |
| 1549 | </p> |
| 1550 | </dd> |
| 1551 | </dl></div> |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1552 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1553 | <dt class="hdlist1"> |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1554 | octopus |
| 1555 | </dt> |
| 1556 | <dd> |
| 1557 | <p> |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 1558 | This resolves cases with more than two heads, but refuses to do |
| 1559 | a complex merge that needs manual resolution. It is |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1560 | primarily meant to be used for bundling topic branch |
| 1561 | heads together. This is the default merge strategy when |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 1562 | pulling or merging more than one branch. |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1563 | </p> |
| 1564 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1565 | <dt class="hdlist1"> |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1566 | ours |
| 1567 | </dt> |
| 1568 | <dd> |
| 1569 | <p> |
Junio C Hamano | bf984de | 2009-11-23 06:11:19 | [diff] [blame] | 1570 | This resolves any number of heads, but the resulting tree of the |
| 1571 | merge is always that of the current branch head, effectively |
| 1572 | ignoring all changes from all other branches. It is meant to |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1573 | be used to supersede old development history of side |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1574 | branches. Note that this is different from the -Xours option to |
| 1575 | the <em>recursive</em> merge strategy. |
Junio C Hamano | 97f518c | 2006-06-22 19:49:35 | [diff] [blame] | 1576 | </p> |
| 1577 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1578 | <dt class="hdlist1"> |
Junio C Hamano | e6c9203 | 2008-03-19 09:24:34 | [diff] [blame] | 1579 | subtree |
| 1580 | </dt> |
| 1581 | <dd> |
| 1582 | <p> |
| 1583 | This is a modified recursive strategy. When merging trees A and |
| 1584 | B, if B corresponds to a subtree of A, B is first adjusted to |
| 1585 | match the tree structure of A, instead of reading the trees at |
| 1586 | the same level. This adjustment is also done to the common |
| 1587 | ancestor tree. |
| 1588 | </p> |
| 1589 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1590 | </dl></div> |
Junio C Hamano | cf77b04 | 2013-12-17 23:54:21 | [diff] [blame] | 1591 | <div class="paragraph"><p>With the strategies that use 3-way merge (including the default, <em>recursive</em>), |
| 1592 | if a change is made on both branches, but later reverted on one of the |
| 1593 | branches, that change will be present in the merged result; some people find |
| 1594 | this behavior confusing. It occurs because only the heads and the merge base |
| 1595 | are considered when performing a merge, not the individual commits. The merge |
| 1596 | algorithm therefore considers the reverted change as no change at all, and |
| 1597 | substitutes the changed version instead.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1598 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1599 | </div> |
| 1600 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1601 | <h2 id="_notes">NOTES</h2> |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 1602 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1603 | <div class="paragraph"><p>You should understand the implications of using <em>git rebase</em> on a |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1604 | repository that you share. See also RECOVERING FROM UPSTREAM REBASE |
| 1605 | below.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1606 | <div class="paragraph"><p>When the git-rebase command is run, it will first execute a "pre-rebase" |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 1607 | hook if one exists. You can use this hook to do sanity checks and |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1608 | reject the rebase if it isn’t appropriate. Please see the template |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1609 | pre-rebase hook script for an example.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1610 | <div class="paragraph"><p>Upon completion, <branch> will be the current branch.</p></div> |
Junio C Hamano | 6112cad | 2006-05-02 07:28:06 | [diff] [blame] | 1611 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1612 | </div> |
| 1613 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1614 | <h2 id="_interactive_mode">INTERACTIVE MODE</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1615 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1616 | <div class="paragraph"><p>Rebasing interactively means that you have a chance to edit the commits |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1617 | which are rebased. You can reorder the commits, and you can |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1618 | remove them (weeding out bad or otherwise unwanted patches).</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1619 | <div class="paragraph"><p>The interactive mode is meant for this type of workflow:</p></div> |
| 1620 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1621 | <li> |
| 1622 | <p> |
| 1623 | have a wonderful idea |
| 1624 | </p> |
| 1625 | </li> |
| 1626 | <li> |
| 1627 | <p> |
| 1628 | hack on the code |
| 1629 | </p> |
| 1630 | </li> |
| 1631 | <li> |
| 1632 | <p> |
| 1633 | prepare a series for submission |
| 1634 | </p> |
| 1635 | </li> |
| 1636 | <li> |
| 1637 | <p> |
| 1638 | submit |
| 1639 | </p> |
| 1640 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1641 | </ol></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1642 | <div class="paragraph"><p>where point 2. consists of several instances of</p></div> |
Junio C Hamano | 0ff9816 | 2012-03-31 18:19:09 | [diff] [blame] | 1643 | <div class="paragraph"><p>a) regular use</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1644 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1645 | <li> |
| 1646 | <p> |
| 1647 | finish something worthy of a commit |
| 1648 | </p> |
| 1649 | </li> |
| 1650 | <li> |
| 1651 | <p> |
| 1652 | commit |
| 1653 | </p> |
| 1654 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1655 | </ol></div> |
Junio C Hamano | 0ff9816 | 2012-03-31 18:19:09 | [diff] [blame] | 1656 | <div class="paragraph"><p>b) independent fixup</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1657 | <div class="olist arabic"><ol class="arabic"> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1658 | <li> |
| 1659 | <p> |
| 1660 | realize that something does not work |
| 1661 | </p> |
| 1662 | </li> |
| 1663 | <li> |
| 1664 | <p> |
| 1665 | fix that |
| 1666 | </p> |
| 1667 | </li> |
| 1668 | <li> |
| 1669 | <p> |
| 1670 | commit it |
| 1671 | </p> |
| 1672 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1673 | </ol></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1674 | <div class="paragraph"><p>Sometimes the thing fixed in b.2. cannot be amended to the not-quite |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1675 | perfect commit it fixes, because that commit is buried deeply in a |
| 1676 | patch series. That is exactly what interactive rebase is for: use it |
| 1677 | after plenty of "a"s and "b"s, by rearranging and editing |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1678 | commits, and squashing multiple commits into one.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1679 | <div class="paragraph"><p>Start it with the last commit you want to retain as-is:</p></div> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1680 | <div class="literalblock"> |
| 1681 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1682 | <pre><code>git rebase -i <after-this-commit></code></pre> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1683 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1684 | <div class="paragraph"><p>An editor will be fired up with all the commits in your current branch |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1685 | (ignoring merge commits), which come after the given commit. You can |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1686 | reorder the commits in this list to your heart’s content, and you can |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1687 | remove them. The list looks more or less like this:</p></div> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1688 | <div class="listingblock"> |
| 1689 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1690 | <pre><code>pick deadbee The oneline of this commit |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1691 | pick fa1afe1 The oneline of the next commit |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1692 | ...</code></pre> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1693 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1694 | <div class="paragraph"><p>The oneline descriptions are purely for your pleasure; <em>git rebase</em> will |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1695 | not look at them but at the commit names ("deadbee" and "fa1afe1" in this |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1696 | example), so do not delete or edit the names.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1697 | <div class="paragraph"><p>By replacing the command "pick" with the command "edit", you can tell |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1698 | <em>git rebase</em> to stop after applying that commit, so that you can edit |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1699 | the files and/or the commit message, amend the commit, and continue |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1700 | rebasing.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1701 | <div class="paragraph"><p>If you just want to edit the commit message for a commit, replace the |
Junio C Hamano | 3d23a0a | 2009-10-19 08:04:30 | [diff] [blame] | 1702 | command "pick" with the command "reword".</p></div> |
Junio C Hamano | d7ed404 | 2015-08-03 19:43:00 | [diff] [blame] | 1703 | <div class="paragraph"><p>To drop a commit, replace the command "pick" with "drop", or just |
| 1704 | delete the matching line.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1705 | <div class="paragraph"><p>If you want to fold two or more commits into one, replace the command |
Junio C Hamano | a9701f0 | 2010-01-21 00:42:16 | [diff] [blame] | 1706 | "pick" for the second and subsequent commits with "squash" or "fixup". |
| 1707 | If the commits had different authors, the folded commit will be |
| 1708 | attributed to the author of the first commit. The suggested commit |
| 1709 | message for the folded commit is the concatenation of the commit |
| 1710 | messages of the first commit and of those with the "squash" command, |
| 1711 | but omits the commit messages of commits with the "fixup" command.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1712 | <div class="paragraph"><p><em>git rebase</em> will stop when "pick" has been replaced with "edit" or |
Junio C Hamano | 3d23a0a | 2009-10-19 08:04:30 | [diff] [blame] | 1713 | when a command fails due to merge errors. When you are done editing |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1714 | and/or resolving conflicts you can continue with <code>git rebase --continue</code>.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1715 | <div class="paragraph"><p>For example, if you want to reorder the last 5 commits, such that what |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1716 | was HEAD~4 becomes the new HEAD. To achieve that, you would call |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1717 | <em>git rebase</em> like this:</p></div> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1718 | <div class="listingblock"> |
| 1719 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1720 | <pre><code>$ git rebase -i HEAD~5</code></pre> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1721 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1722 | <div class="paragraph"><p>And move the first patch to the end of the list.</p></div> |
| 1723 | <div class="paragraph"><p>You might want to preserve merges, if you have a history like this:</p></div> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1724 | <div class="listingblock"> |
| 1725 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1726 | <pre><code> X |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1727 | \ |
| 1728 | A---M---B |
| 1729 | / |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1730 | ---o---O---P---Q</code></pre> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1731 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1732 | <div class="paragraph"><p>Suppose you want to rebase the side branch starting at "A" to "Q". Make |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1733 | sure that the current HEAD is "B", and call</p></div> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1734 | <div class="listingblock"> |
| 1735 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1736 | <pre><code>$ git rebase -i -p --onto Q O</code></pre> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1737 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1738 | <div class="paragraph"><p>Reordering and editing commits usually creates untested intermediate |
Junio C Hamano | 53ba6d0 | 2010-08-22 07:25:12 | [diff] [blame] | 1739 | steps. You may want to check that your history editing did not break |
| 1740 | anything by running a test, or at least recompiling at intermediate |
| 1741 | points in history by using the "exec" command (shortcut "x"). You may |
| 1742 | do so by creating a todo list like this one:</p></div> |
| 1743 | <div class="listingblock"> |
| 1744 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1745 | <pre><code>pick deadbee Implement feature XXX |
Junio C Hamano | 53ba6d0 | 2010-08-22 07:25:12 | [diff] [blame] | 1746 | fixup f1a5c00 Fix to feature XXX |
| 1747 | exec make |
| 1748 | pick c0ffeee The oneline of the next commit |
| 1749 | edit deadbab The oneline of the commit after |
| 1750 | exec cd subdir; make test |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1751 | ...</code></pre> |
Junio C Hamano | 53ba6d0 | 2010-08-22 07:25:12 | [diff] [blame] | 1752 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1753 | <div class="paragraph"><p>The interactive rebase will stop when a command fails (i.e. exits with |
Junio C Hamano | 53ba6d0 | 2010-08-22 07:25:12 | [diff] [blame] | 1754 | non-0 status) to give you an opportunity to fix the problem. You can |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1755 | continue with <code>git rebase --continue</code>.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1756 | <div class="paragraph"><p>The "exec" command launches the command in a shell (the one specified |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1757 | in <code>$SHELL</code>, or the default shell if <code>$SHELL</code> is not set), so you can |
Junio C Hamano | 53ba6d0 | 2010-08-22 07:25:12 | [diff] [blame] | 1758 | use shell features (like "cd", ">", ";" …). The command is run from |
| 1759 | the root of the working tree.</p></div> |
Junio C Hamano | 644936c | 2012-06-28 23:05:14 | [diff] [blame] | 1760 | <div class="listingblock"> |
| 1761 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1762 | <pre><code>$ git rebase -i --exec "make test"</code></pre> |
Junio C Hamano | 644936c | 2012-06-28 23:05:14 | [diff] [blame] | 1763 | </div></div> |
| 1764 | <div class="paragraph"><p>This command lets you check that intermediate commits are compilable. |
| 1765 | The todo list becomes like that:</p></div> |
| 1766 | <div class="listingblock"> |
| 1767 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1768 | <pre><code>pick 5928aea one |
Junio C Hamano | 644936c | 2012-06-28 23:05:14 | [diff] [blame] | 1769 | exec make test |
| 1770 | pick 04d0fda two |
| 1771 | exec make test |
| 1772 | pick ba46169 three |
| 1773 | exec make test |
| 1774 | pick f4593f9 four |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1775 | exec make test</code></pre> |
Junio C Hamano | 644936c | 2012-06-28 23:05:14 | [diff] [blame] | 1776 | </div></div> |
Junio C Hamano | 1d90cb0 | 2007-07-03 07:05:31 | [diff] [blame] | 1777 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1778 | </div> |
| 1779 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1780 | <h2 id="_splitting_commits">SPLITTING COMMITS</h2> |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 1781 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1782 | <div class="paragraph"><p>In interactive mode, you can mark commits with the action "edit". However, |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1783 | this does not necessarily mean that <em>git rebase</em> expects the result of this |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 1784 | edit to be exactly one commit. Indeed, you can undo the commit, or you can |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1785 | add other commits. This can be used to split a commit into two:</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1786 | <div class="ulist"><ul> |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 1787 | <li> |
| 1788 | <p> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1789 | Start an interactive rebase with <code>git rebase -i <commit>^</code>, where |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 1790 | <commit> is the commit you want to split. In fact, any commit range |
| 1791 | will do, as long as it contains that commit. |
| 1792 | </p> |
| 1793 | </li> |
| 1794 | <li> |
| 1795 | <p> |
| 1796 | Mark the commit you want to split with the action "edit". |
| 1797 | </p> |
| 1798 | </li> |
| 1799 | <li> |
| 1800 | <p> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1801 | When it comes to editing that commit, execute <code>git reset HEAD^</code>. The |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 1802 | effect is that the HEAD is rewound by one, and the index follows suit. |
| 1803 | However, the working tree stays the same. |
| 1804 | </p> |
| 1805 | </li> |
| 1806 | <li> |
| 1807 | <p> |
| 1808 | Now add the changes to the index that you want to have in the first |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1809 | commit. You can use <code>git add</code> (possibly interactively) or |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1810 | <em>git gui</em> (or both) to do that. |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 1811 | </p> |
| 1812 | </li> |
| 1813 | <li> |
| 1814 | <p> |
| 1815 | Commit the now-current index with whatever commit message is appropriate |
| 1816 | now. |
| 1817 | </p> |
| 1818 | </li> |
| 1819 | <li> |
| 1820 | <p> |
| 1821 | Repeat the last two steps until your working tree is clean. |
| 1822 | </p> |
| 1823 | </li> |
| 1824 | <li> |
| 1825 | <p> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1826 | Continue the rebase with <code>git rebase --continue</code>. |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 1827 | </p> |
| 1828 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1829 | </ul></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1830 | <div class="paragraph"><p>If you are not absolutely sure that the intermediate revisions are |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 1831 | consistent (they compile, pass the testsuite, etc.) you should use |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1832 | <em>git stash</em> to stash away the not-yet-committed changes |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1833 | after each commit, test, and amend the commit if fixes are necessary.</p></div> |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 1834 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1835 | </div> |
| 1836 | <div class="sect1"> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1837 | <h2 id="_recovering_from_upstream_rebase">RECOVERING FROM UPSTREAM REBASE</h2> |
| 1838 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1839 | <div class="paragraph"><p>Rebasing (or any other form of rewriting) a branch that others have |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1840 | based work on is a bad idea: anyone downstream of it is forced to |
| 1841 | manually fix their history. This section explains how to do the fix |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1842 | from the downstream’s point of view. The real fix, however, would be |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1843 | to avoid rebasing the upstream in the first place.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1844 | <div class="paragraph"><p>To illustrate, suppose you are in a situation where someone develops a |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1845 | <em>subsystem</em> branch, and you are working on a <em>topic</em> that is dependent |
| 1846 | on this <em>subsystem</em>. You might end up with a history like the |
| 1847 | following:</p></div> |
| 1848 | <div class="listingblock"> |
| 1849 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1850 | <pre><code> o---o---o---o---o---o---o---o---o master |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1851 | \ |
| 1852 | o---o---o---o---o subsystem |
| 1853 | \ |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1854 | *---*---* topic</code></pre> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1855 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1856 | <div class="paragraph"><p>If <em>subsystem</em> is rebased against <em>master</em>, the following happens:</p></div> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1857 | <div class="listingblock"> |
| 1858 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1859 | <pre><code> o---o---o---o---o---o---o---o master |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1860 | \ \ |
| 1861 | o---o---o---o---o o'--o'--o'--o'--o' subsystem |
| 1862 | \ |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1863 | *---*---* topic</code></pre> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1864 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1865 | <div class="paragraph"><p>If you now continue development as usual, and eventually merge <em>topic</em> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1866 | to <em>subsystem</em>, the commits from <em>subsystem</em> will remain duplicated forever:</p></div> |
| 1867 | <div class="listingblock"> |
| 1868 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1869 | <pre><code> o---o---o---o---o---o---o---o master |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1870 | \ \ |
| 1871 | o---o---o---o---o o'--o'--o'--o'--o'--M subsystem |
| 1872 | \ / |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1873 | *---*---*-..........-*--* topic</code></pre> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1874 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1875 | <div class="paragraph"><p>Such duplicates are generally frowned upon because they clutter up |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1876 | history, making it harder to follow. To clean things up, you need to |
| 1877 | transplant the commits on <em>topic</em> to the new <em>subsystem</em> tip, i.e., |
| 1878 | rebase <em>topic</em>. This becomes a ripple effect: anyone downstream from |
| 1879 | <em>topic</em> is forced to rebase too, and so on!</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1880 | <div class="paragraph"><p>There are two kinds of fixes, discussed in the following subsections:</p></div> |
| 1881 | <div class="dlist"><dl> |
| 1882 | <dt class="hdlist1"> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1883 | Easy case: The changes are literally the same. |
| 1884 | </dt> |
| 1885 | <dd> |
| 1886 | <p> |
| 1887 | This happens if the <em>subsystem</em> rebase was a simple rebase and |
| 1888 | had no conflicts. |
| 1889 | </p> |
| 1890 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1891 | <dt class="hdlist1"> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1892 | Hard case: The changes are not the same. |
| 1893 | </dt> |
| 1894 | <dd> |
| 1895 | <p> |
| 1896 | This happens if the <em>subsystem</em> rebase had conflicts, or used |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1897 | <code>--interactive</code> to omit, edit, squash, or fixup commits; or |
| 1898 | if the upstream used one of <code>commit --amend</code>, <code>reset</code>, or |
| 1899 | <code>filter-branch</code>. |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1900 | </p> |
| 1901 | </dd> |
| 1902 | </dl></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1903 | <div class="sect2"> |
| 1904 | <h3 id="_the_easy_case">The easy case</h3> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1905 | <div class="paragraph"><p>Only works if the changes (patch IDs based on the diff contents) on |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1906 | <em>subsystem</em> are literally the same before and after the rebase |
| 1907 | <em>subsystem</em> did.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1908 | <div class="paragraph"><p>In that case, the fix is easy because <em>git rebase</em> knows to skip |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1909 | changes that are already present in the new upstream. So if you say |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1910 | (assuming you’re on <em>topic</em>)</p></div> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1911 | <div class="listingblock"> |
| 1912 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1913 | <pre><code> $ git rebase subsystem</code></pre> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1914 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1915 | <div class="paragraph"><p>you will end up with the fixed history</p></div> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1916 | <div class="listingblock"> |
| 1917 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1918 | <pre><code> o---o---o---o---o---o---o---o master |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1919 | \ |
| 1920 | o'--o'--o'--o'--o' subsystem |
| 1921 | \ |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1922 | *---*---* topic</code></pre> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1923 | </div></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1924 | </div> |
| 1925 | <div class="sect2"> |
| 1926 | <h3 id="_the_hard_case">The hard case</h3> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1927 | <div class="paragraph"><p>Things get more complicated if the <em>subsystem</em> changes do not exactly |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1928 | correspond to the ones before the rebase.</p></div> |
| 1929 | <div class="admonitionblock"> |
| 1930 | <table><tr> |
| 1931 | <td class="icon"> |
| 1932 | <div class="title">Note</div> |
| 1933 | </td> |
| 1934 | <td class="content">While an "easy case recovery" sometimes appears to be successful |
| 1935 | even in the hard case, it may have unintended consequences. For |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1936 | example, a commit that was removed via <code>git rebase |
| 1937 | --interactive</code> will be <strong>resurrected</strong>!</td> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1938 | </tr></table> |
| 1939 | </div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1940 | <div class="paragraph"><p>The idea is to manually tell <em>git rebase</em> "where the old <em>subsystem</em> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1941 | ended and your <em>topic</em> began", that is, what the old merge-base |
| 1942 | between them was. You will have to find a way to name the last commit |
| 1943 | of the old <em>subsystem</em>, for example:</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1944 | <div class="ulist"><ul> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1945 | <li> |
| 1946 | <p> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 1947 | With the <em>subsystem</em> reflog: after <em>git fetch</em>, the old tip of |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1948 | <em>subsystem</em> is at <code>subsystem@{1}</code>. Subsequent fetches will |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1949 | increase the number. (See <a href="git-reflog.html">git-reflog(1)</a>.) |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1950 | </p> |
| 1951 | </li> |
| 1952 | <li> |
| 1953 | <p> |
| 1954 | Relative to the tip of <em>topic</em>: knowing that your <em>topic</em> has three |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1955 | commits, the old tip of <em>subsystem</em> must be <code>topic~3</code>. |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1956 | </p> |
| 1957 | </li> |
| 1958 | </ul></div> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1959 | <div class="paragraph"><p>You can then transplant the old <code>subsystem..topic</code> to the new tip by |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1960 | saying (for the reflog case, and assuming you are on <em>topic</em> already):</p></div> |
| 1961 | <div class="listingblock"> |
| 1962 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1963 | <pre><code> $ git rebase --onto subsystem subsystem@{1}</code></pre> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1964 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1965 | <div class="paragraph"><p>The ripple effect of a "hard case" recovery is especially bad: |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 1966 | <em>everyone</em> downstream from <em>topic</em> will now have to perform a "hard |
| 1967 | case" recovery too!</p></div> |
| 1968 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1969 | </div> |
| 1970 | </div> |
| 1971 | <div class="sect1"> |
Junio C Hamano | bb88cf4 | 2010-06-21 15:23:55 | [diff] [blame] | 1972 | <h2 id="_bugs">BUGS</h2> |
| 1973 | <div class="sectionbody"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1974 | <div class="paragraph"><p>The todo list presented by <code>--preserve-merges --interactive</code> does not |
Junio C Hamano | bb88cf4 | 2010-06-21 15:23:55 | [diff] [blame] | 1975 | represent the topology of the revision graph. Editing commits and |
| 1976 | rewording their commit messages should work fine, but attempts to |
| 1977 | reorder commits tend to produce counterintuitive results.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1978 | <div class="paragraph"><p>For example, an attempt to rearrange</p></div> |
Junio C Hamano | bb88cf4 | 2010-06-21 15:23:55 | [diff] [blame] | 1979 | <div class="listingblock"> |
| 1980 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1981 | <pre><code>1 --- 2 --- 3 --- 4 --- 5</code></pre> |
Junio C Hamano | bb88cf4 | 2010-06-21 15:23:55 | [diff] [blame] | 1982 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1983 | <div class="paragraph"><p>to</p></div> |
Junio C Hamano | bb88cf4 | 2010-06-21 15:23:55 | [diff] [blame] | 1984 | <div class="listingblock"> |
| 1985 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1986 | <pre><code>1 --- 2 --- 4 --- 3 --- 5</code></pre> |
Junio C Hamano | bb88cf4 | 2010-06-21 15:23:55 | [diff] [blame] | 1987 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1988 | <div class="paragraph"><p>by moving the "pick 4" line will result in the following history:</p></div> |
Junio C Hamano | bb88cf4 | 2010-06-21 15:23:55 | [diff] [blame] | 1989 | <div class="listingblock"> |
| 1990 | <div class="content"> |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1991 | <pre><code> 3 |
Junio C Hamano | bb88cf4 | 2010-06-21 15:23:55 | [diff] [blame] | 1992 | / |
Junio C Hamano | ac12f0e | 2014-09-19 22:32:51 | [diff] [blame] | 1993 | 1 --- 2 --- 4 --- 5</code></pre> |
Junio C Hamano | bb88cf4 | 2010-06-21 15:23:55 | [diff] [blame] | 1994 | </div></div> |
| 1995 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1996 | </div> |
| 1997 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1998 | <h2 id="_git">GIT</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1999 | <div class="sectionbody"> |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 2000 | <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2001 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 2002 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 2003 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 2004 | <div id="footnotes"><hr /></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2005 | <div id="footer"> |
| 2006 | <div id="footer-text"> |
Junio C Hamano | 1eb5609 | 2015-10-05 20:39:53 | [diff] [blame] | 2007 | Last updated 2015-10-05 13:38:43 PDT |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2008 | </div> |
| 2009 | </div> |
| 2010 | </body> |
| 2011 | </html> |