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