Junio C Hamano | 944ce25 | 2018-05-30 22:25:26 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
| 3 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| 5 | <head> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 6 | <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> |
Junio C Hamano | 944ce25 | 2018-05-30 22:25:26 | [diff] [blame] | 7 | <meta name="generator" content="AsciiDoc 8.6.10" /> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 8 | <title>git-reset(1)</title> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 9 | <style type="text/css"> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 10 | /* Shared CSS for AsciiDoc xhtml11 and html5 backends */ |
| 11 | |
| 12 | /* Default font. */ |
| 13 | body { |
| 14 | font-family: Georgia,serif; |
| 15 | } |
| 16 | |
| 17 | /* Title font. */ |
| 18 | h1, h2, h3, h4, h5, h6, |
| 19 | div.title, caption.title, |
| 20 | thead, p.table.header, |
| 21 | #toctitle, |
| 22 | #author, #revnumber, #revdate, #revremark, |
| 23 | #footer { |
| 24 | font-family: Arial,Helvetica,sans-serif; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | body { |
| 28 | margin: 1em 5% 1em 5%; |
| 29 | } |
| 30 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 31 | a { |
| 32 | color: blue; |
| 33 | text-decoration: underline; |
| 34 | } |
| 35 | a:visited { |
| 36 | color: fuchsia; |
| 37 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 38 | |
| 39 | em { |
| 40 | font-style: italic; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 41 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | strong { |
| 45 | font-weight: bold; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 46 | color: #083194; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 47 | } |
| 48 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 49 | h1, h2, h3, h4, h5, h6 { |
| 50 | color: #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 51 | margin-top: 1.2em; |
| 52 | margin-bottom: 0.5em; |
| 53 | line-height: 1.3; |
| 54 | } |
| 55 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 56 | h1, h2, h3 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 57 | border-bottom: 2px solid silver; |
| 58 | } |
| 59 | h2 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 60 | padding-top: 0.5em; |
| 61 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 62 | h3 { |
| 63 | float: left; |
| 64 | } |
| 65 | h3 + * { |
| 66 | clear: left; |
| 67 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 68 | h5 { |
| 69 | font-size: 1.0em; |
| 70 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 71 | |
| 72 | div.sectionbody { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 73 | margin-left: 0; |
| 74 | } |
| 75 | |
| 76 | hr { |
| 77 | border: 1px solid silver; |
| 78 | } |
| 79 | |
| 80 | p { |
| 81 | margin-top: 0.5em; |
| 82 | margin-bottom: 0.5em; |
| 83 | } |
| 84 | |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 85 | ul, ol, li > p { |
| 86 | margin-top: 0; |
| 87 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 88 | ul > li { color: #aaa; } |
| 89 | ul > li > * { color: black; } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 90 | |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 91 | .monospaced, code, pre { |
| 92 | font-family: "Courier New", Courier, monospace; |
| 93 | font-size: inherit; |
| 94 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 95 | padding: 0; |
| 96 | margin: 0; |
| 97 | } |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 98 | pre { |
| 99 | white-space: pre-wrap; |
| 100 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 101 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 102 | #author { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 103 | color: #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 104 | font-weight: bold; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 105 | font-size: 1.1em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 106 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 107 | #email { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 108 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 109 | #revnumber, #revdate, #revremark { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 110 | } |
| 111 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 112 | #footer { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 113 | font-size: small; |
| 114 | border-top: 2px solid silver; |
| 115 | padding-top: 0.5em; |
| 116 | margin-top: 4.0em; |
| 117 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 118 | #footer-text { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 119 | float: left; |
| 120 | padding-bottom: 0.5em; |
| 121 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 122 | #footer-badges { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 123 | float: right; |
| 124 | padding-bottom: 0.5em; |
| 125 | } |
| 126 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 127 | #preamble { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 128 | margin-top: 1.5em; |
| 129 | margin-bottom: 1.5em; |
| 130 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 131 | div.imageblock, div.exampleblock, div.verseblock, |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 132 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 133 | div.admonitionblock { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 134 | margin-top: 1.0em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 135 | margin-bottom: 1.5em; |
| 136 | } |
| 137 | div.admonitionblock { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 138 | margin-top: 2.0em; |
| 139 | margin-bottom: 2.0em; |
| 140 | margin-right: 10%; |
| 141 | color: #606060; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | div.content { /* Block element content. */ |
| 145 | padding: 0; |
| 146 | } |
| 147 | |
| 148 | /* Block element titles. */ |
| 149 | div.title, caption.title { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 150 | color: #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 151 | font-weight: bold; |
| 152 | text-align: left; |
| 153 | margin-top: 1.0em; |
| 154 | margin-bottom: 0.5em; |
| 155 | } |
| 156 | div.title + * { |
| 157 | margin-top: 0; |
| 158 | } |
| 159 | |
| 160 | td div.title:first-child { |
| 161 | margin-top: 0.0em; |
| 162 | } |
| 163 | div.content div.title:first-child { |
| 164 | margin-top: 0.0em; |
| 165 | } |
| 166 | div.content + div.title { |
| 167 | margin-top: 0.0em; |
| 168 | } |
| 169 | |
| 170 | div.sidebarblock > div.content { |
| 171 | background: #ffffee; |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 172 | border: 1px solid #dddddd; |
| 173 | border-left: 4px solid #f0f0f0; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 174 | padding: 0.5em; |
| 175 | } |
| 176 | |
| 177 | div.listingblock > div.content { |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 178 | border: 1px solid #dddddd; |
| 179 | border-left: 5px solid #f0f0f0; |
| 180 | background: #f8f8f8; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 181 | padding: 0.5em; |
| 182 | } |
| 183 | |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 184 | div.quoteblock, div.verseblock { |
| 185 | padding-left: 1.0em; |
| 186 | margin-left: 1.0em; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 187 | margin-right: 10%; |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 188 | border-left: 5px solid #f0f0f0; |
| 189 | color: #888; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 190 | } |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 191 | |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 192 | div.quoteblock > div.attribution { |
| 193 | padding-top: 0.5em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 194 | text-align: right; |
| 195 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 196 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 197 | div.verseblock > pre.content { |
| 198 | font-family: inherit; |
| 199 | font-size: inherit; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 200 | } |
| 201 | div.verseblock > div.attribution { |
| 202 | padding-top: 0.75em; |
| 203 | text-align: left; |
| 204 | } |
| 205 | /* DEPRECATED: Pre version 8.2.7 verse style literal block. */ |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 206 | div.verseblock + div.attribution { |
| 207 | text-align: left; |
| 208 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 209 | |
| 210 | div.admonitionblock .icon { |
| 211 | vertical-align: top; |
| 212 | font-size: 1.1em; |
| 213 | font-weight: bold; |
| 214 | text-decoration: underline; |
| 215 | color: #527bbd; |
| 216 | padding-right: 0.5em; |
| 217 | } |
| 218 | div.admonitionblock td.content { |
| 219 | padding-left: 0.5em; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 220 | border-left: 3px solid #dddddd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | div.exampleblock > div.content { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 224 | border-left: 3px solid #dddddd; |
| 225 | padding-left: 0.5em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 226 | } |
| 227 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 228 | div.imageblock div.content { padding-left: 0; } |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 229 | span.image img { border-style: none; vertical-align: text-bottom; } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 230 | a.image:visited { color: white; } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 231 | |
| 232 | dl { |
| 233 | margin-top: 0.8em; |
| 234 | margin-bottom: 0.8em; |
| 235 | } |
| 236 | dt { |
| 237 | margin-top: 0.5em; |
| 238 | margin-bottom: 0; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 239 | font-style: normal; |
| 240 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 241 | } |
| 242 | dd > *:first-child { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 243 | margin-top: 0.1em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | ul, ol { |
| 247 | list-style-position: outside; |
| 248 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 249 | ol.arabic { |
| 250 | list-style-type: decimal; |
| 251 | } |
| 252 | ol.loweralpha { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 253 | list-style-type: lower-alpha; |
| 254 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 255 | ol.upperalpha { |
| 256 | list-style-type: upper-alpha; |
| 257 | } |
| 258 | ol.lowerroman { |
| 259 | list-style-type: lower-roman; |
| 260 | } |
| 261 | ol.upperroman { |
| 262 | list-style-type: upper-roman; |
| 263 | } |
| 264 | |
| 265 | div.compact ul, div.compact ol, |
| 266 | div.compact p, div.compact p, |
| 267 | div.compact div, div.compact div { |
| 268 | margin-top: 0.1em; |
| 269 | margin-bottom: 0.1em; |
| 270 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 271 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 272 | tfoot { |
| 273 | font-weight: bold; |
| 274 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 275 | td > div.verse { |
| 276 | white-space: pre; |
| 277 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 278 | |
| 279 | div.hdlist { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 280 | margin-top: 0.8em; |
| 281 | margin-bottom: 0.8em; |
| 282 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 283 | div.hdlist tr { |
| 284 | padding-bottom: 15px; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 285 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 286 | dt.hdlist1.strong, td.hdlist1.strong { |
| 287 | font-weight: bold; |
| 288 | } |
| 289 | td.hdlist1 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 290 | vertical-align: top; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 291 | font-style: normal; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 292 | padding-right: 0.8em; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 293 | color: navy; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 294 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 295 | td.hdlist2 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 296 | vertical-align: top; |
| 297 | } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 298 | div.hdlist.compact tr { |
| 299 | margin: 0; |
| 300 | padding-bottom: 0; |
| 301 | } |
| 302 | |
| 303 | .comment { |
| 304 | background: yellow; |
| 305 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 306 | |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 307 | .footnote, .footnoteref { |
| 308 | font-size: 0.8em; |
| 309 | } |
| 310 | |
| 311 | span.footnote, span.footnoteref { |
| 312 | vertical-align: super; |
| 313 | } |
| 314 | |
| 315 | #footnotes { |
| 316 | margin: 20px 0 20px 0; |
| 317 | padding: 7px 0 0 0; |
| 318 | } |
| 319 | |
| 320 | #footnotes div.footnote { |
| 321 | margin: 0 0 5px 0; |
| 322 | } |
| 323 | |
| 324 | #footnotes hr { |
| 325 | border: none; |
| 326 | border-top: 1px solid silver; |
| 327 | height: 1px; |
| 328 | text-align: left; |
| 329 | margin-left: 0; |
| 330 | width: 20%; |
| 331 | min-width: 100px; |
| 332 | } |
| 333 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 334 | div.colist td { |
| 335 | padding-right: 0.5em; |
| 336 | padding-bottom: 0.3em; |
| 337 | vertical-align: top; |
| 338 | } |
| 339 | div.colist td img { |
| 340 | margin-top: 0.3em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 341 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 342 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 343 | @media print { |
| 344 | #footer-badges { display: none; } |
| 345 | } |
| 346 | |
| 347 | #toc { |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 348 | margin-bottom: 2.5em; |
| 349 | } |
| 350 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 351 | #toctitle { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 352 | color: #527bbd; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 353 | font-size: 1.1em; |
| 354 | font-weight: bold; |
| 355 | margin-top: 1.0em; |
| 356 | margin-bottom: 0.1em; |
| 357 | } |
| 358 | |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 359 | div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 360 | margin-top: 0; |
| 361 | margin-bottom: 0; |
| 362 | } |
| 363 | div.toclevel2 { |
| 364 | margin-left: 2em; |
| 365 | font-size: 0.9em; |
| 366 | } |
| 367 | div.toclevel3 { |
| 368 | margin-left: 4em; |
| 369 | font-size: 0.9em; |
| 370 | } |
| 371 | div.toclevel4 { |
| 372 | margin-left: 6em; |
| 373 | font-size: 0.9em; |
| 374 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 375 | |
| 376 | span.aqua { color: aqua; } |
| 377 | span.black { color: black; } |
| 378 | span.blue { color: blue; } |
| 379 | span.fuchsia { color: fuchsia; } |
| 380 | span.gray { color: gray; } |
| 381 | span.green { color: green; } |
| 382 | span.lime { color: lime; } |
| 383 | span.maroon { color: maroon; } |
| 384 | span.navy { color: navy; } |
| 385 | span.olive { color: olive; } |
| 386 | span.purple { color: purple; } |
| 387 | span.red { color: red; } |
| 388 | span.silver { color: silver; } |
| 389 | span.teal { color: teal; } |
| 390 | span.white { color: white; } |
| 391 | span.yellow { color: yellow; } |
| 392 | |
| 393 | span.aqua-background { background: aqua; } |
| 394 | span.black-background { background: black; } |
| 395 | span.blue-background { background: blue; } |
| 396 | span.fuchsia-background { background: fuchsia; } |
| 397 | span.gray-background { background: gray; } |
| 398 | span.green-background { background: green; } |
| 399 | span.lime-background { background: lime; } |
| 400 | span.maroon-background { background: maroon; } |
| 401 | span.navy-background { background: navy; } |
| 402 | span.olive-background { background: olive; } |
| 403 | span.purple-background { background: purple; } |
| 404 | span.red-background { background: red; } |
| 405 | span.silver-background { background: silver; } |
| 406 | span.teal-background { background: teal; } |
| 407 | span.white-background { background: white; } |
| 408 | span.yellow-background { background: yellow; } |
| 409 | |
| 410 | span.big { font-size: 2em; } |
| 411 | span.small { font-size: 0.6em; } |
| 412 | |
| 413 | span.underline { text-decoration: underline; } |
| 414 | span.overline { text-decoration: overline; } |
| 415 | span.line-through { text-decoration: line-through; } |
| 416 | |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 417 | div.unbreakable { page-break-inside: avoid; } |
| 418 | |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 419 | |
| 420 | /* |
| 421 | * xhtml11 specific |
| 422 | * |
| 423 | * */ |
| 424 | |
| 425 | div.tableblock { |
| 426 | margin-top: 1.0em; |
| 427 | margin-bottom: 1.5em; |
| 428 | } |
| 429 | div.tableblock > table { |
| 430 | border: 3px solid #527bbd; |
| 431 | } |
| 432 | thead, p.table.header { |
| 433 | font-weight: bold; |
| 434 | color: #527bbd; |
| 435 | } |
| 436 | p.table { |
| 437 | margin-top: 0; |
| 438 | } |
| 439 | /* Because the table frame attribute is overriden by CSS in most browsers. */ |
| 440 | div.tableblock > table[frame="void"] { |
| 441 | border-style: none; |
| 442 | } |
| 443 | div.tableblock > table[frame="hsides"] { |
| 444 | border-left-style: none; |
| 445 | border-right-style: none; |
| 446 | } |
| 447 | div.tableblock > table[frame="vsides"] { |
| 448 | border-top-style: none; |
| 449 | border-bottom-style: none; |
| 450 | } |
| 451 | |
| 452 | |
| 453 | /* |
| 454 | * html5 specific |
| 455 | * |
| 456 | * */ |
| 457 | |
| 458 | table.tableblock { |
| 459 | margin-top: 1.0em; |
| 460 | margin-bottom: 1.5em; |
| 461 | } |
| 462 | thead, p.tableblock.header { |
| 463 | font-weight: bold; |
| 464 | color: #527bbd; |
| 465 | } |
| 466 | p.tableblock { |
| 467 | margin-top: 0; |
| 468 | } |
| 469 | table.tableblock { |
| 470 | border-width: 3px; |
| 471 | border-spacing: 0px; |
| 472 | border-style: solid; |
| 473 | border-color: #527bbd; |
| 474 | border-collapse: collapse; |
| 475 | } |
| 476 | th.tableblock, td.tableblock { |
| 477 | border-width: 1px; |
| 478 | padding: 4px; |
| 479 | border-style: solid; |
| 480 | border-color: #527bbd; |
| 481 | } |
| 482 | |
| 483 | table.tableblock.frame-topbot { |
| 484 | border-left-style: hidden; |
| 485 | border-right-style: hidden; |
| 486 | } |
| 487 | table.tableblock.frame-sides { |
| 488 | border-top-style: hidden; |
| 489 | border-bottom-style: hidden; |
| 490 | } |
| 491 | table.tableblock.frame-none { |
| 492 | border-style: hidden; |
| 493 | } |
| 494 | |
| 495 | th.tableblock.halign-left, td.tableblock.halign-left { |
| 496 | text-align: left; |
| 497 | } |
| 498 | th.tableblock.halign-center, td.tableblock.halign-center { |
| 499 | text-align: center; |
| 500 | } |
| 501 | th.tableblock.halign-right, td.tableblock.halign-right { |
| 502 | text-align: right; |
| 503 | } |
| 504 | |
| 505 | th.tableblock.valign-top, td.tableblock.valign-top { |
| 506 | vertical-align: top; |
| 507 | } |
| 508 | th.tableblock.valign-middle, td.tableblock.valign-middle { |
| 509 | vertical-align: middle; |
| 510 | } |
| 511 | th.tableblock.valign-bottom, td.tableblock.valign-bottom { |
| 512 | vertical-align: bottom; |
| 513 | } |
| 514 | |
| 515 | |
| 516 | /* |
| 517 | * manpage specific |
| 518 | * |
| 519 | * */ |
| 520 | |
| 521 | body.manpage h1 { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 522 | padding-top: 0.5em; |
| 523 | padding-bottom: 0.5em; |
| 524 | border-top: 2px solid silver; |
| 525 | border-bottom: 2px solid silver; |
| 526 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 527 | body.manpage h2 { |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 528 | border-style: none; |
| 529 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 530 | body.manpage div.sectionbody { |
| 531 | margin-left: 3em; |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 532 | } |
| 533 | |
| 534 | @media print { |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 535 | body.manpage div#toc { display: none; } |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 536 | } |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 537 | |
| 538 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 539 | </style> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 540 | <script type="text/javascript"> |
| 541 | /*<![CDATA[*/ |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 542 | var asciidoc = { // Namespace. |
| 543 | |
| 544 | ///////////////////////////////////////////////////////////////////// |
| 545 | // Table Of Contents generator |
| 546 | ///////////////////////////////////////////////////////////////////// |
| 547 | |
| 548 | /* Author: Mihai Bazon, September 2002 |
| 549 | * http://students.infoiasi.ro/~mishoo |
| 550 | * |
| 551 | * Table Of Content generator |
| 552 | * Version: 0.4 |
| 553 | * |
| 554 | * Feel free to use this script under the terms of the GNU General Public |
| 555 | * License, as long as you do not remove or alter this notice. |
| 556 | */ |
| 557 | |
| 558 | /* modified by Troy D. Hanson, September 2006. License: GPL */ |
| 559 | /* modified by Stuart Rackham, 2006, 2009. License: GPL */ |
| 560 | |
| 561 | // toclevels = 1..4. |
| 562 | toc: function (toclevels) { |
| 563 | |
| 564 | function getText(el) { |
| 565 | var text = ""; |
| 566 | for (var i = el.firstChild; i != null; i = i.nextSibling) { |
| 567 | if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants. |
| 568 | text += i.data; |
| 569 | else if (i.firstChild != null) |
| 570 | text += getText(i); |
| 571 | } |
| 572 | return text; |
| 573 | } |
| 574 | |
| 575 | function TocEntry(el, text, toclevel) { |
| 576 | this.element = el; |
| 577 | this.text = text; |
| 578 | this.toclevel = toclevel; |
| 579 | } |
| 580 | |
| 581 | function tocEntries(el, toclevels) { |
| 582 | var result = new Array; |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 583 | var re = new RegExp('[hH]([1-'+(toclevels+1)+'])'); |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 584 | // Function that scans the DOM tree for header elements (the DOM2 |
| 585 | // nodeIterator API would be a better technique but not supported by all |
| 586 | // browsers). |
| 587 | var iterate = function (el) { |
| 588 | for (var i = el.firstChild; i != null; i = i.nextSibling) { |
| 589 | if (i.nodeType == 1 /* Node.ELEMENT_NODE */) { |
| 590 | var mo = re.exec(i.tagName); |
| 591 | if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") { |
| 592 | result[result.length] = new TocEntry(i, getText(i), mo[1]-1); |
| 593 | } |
| 594 | iterate(i); |
| 595 | } |
| 596 | } |
| 597 | } |
| 598 | iterate(el); |
| 599 | return result; |
| 600 | } |
| 601 | |
| 602 | var toc = document.getElementById("toc"); |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 603 | if (!toc) { |
| 604 | return; |
| 605 | } |
| 606 | |
| 607 | // Delete existing TOC entries in case we're reloading the TOC. |
| 608 | var tocEntriesToRemove = []; |
| 609 | var i; |
| 610 | for (i = 0; i < toc.childNodes.length; i++) { |
| 611 | var entry = toc.childNodes[i]; |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 612 | if (entry.nodeName.toLowerCase() == 'div' |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 613 | && entry.getAttribute("class") |
| 614 | && entry.getAttribute("class").match(/^toclevel/)) |
| 615 | tocEntriesToRemove.push(entry); |
| 616 | } |
| 617 | for (i = 0; i < tocEntriesToRemove.length; i++) { |
| 618 | toc.removeChild(tocEntriesToRemove[i]); |
| 619 | } |
| 620 | |
| 621 | // Rebuild TOC entries. |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 622 | var entries = tocEntries(document.getElementById("content"), toclevels); |
| 623 | for (var i = 0; i < entries.length; ++i) { |
| 624 | var entry = entries[i]; |
| 625 | if (entry.element.id == "") |
| 626 | entry.element.id = "_toc_" + i; |
| 627 | var a = document.createElement("a"); |
| 628 | a.href = "#" + entry.element.id; |
| 629 | a.appendChild(document.createTextNode(entry.text)); |
| 630 | var div = document.createElement("div"); |
| 631 | div.appendChild(a); |
| 632 | div.className = "toclevel" + entry.toclevel; |
| 633 | toc.appendChild(div); |
| 634 | } |
| 635 | if (entries.length == 0) |
| 636 | toc.parentNode.removeChild(toc); |
| 637 | }, |
| 638 | |
| 639 | |
| 640 | ///////////////////////////////////////////////////////////////////// |
| 641 | // Footnotes generator |
| 642 | ///////////////////////////////////////////////////////////////////// |
| 643 | |
| 644 | /* Based on footnote generation code from: |
| 645 | * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html |
| 646 | */ |
| 647 | |
| 648 | footnotes: function () { |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 649 | // Delete existing footnote entries in case we're reloading the footnodes. |
| 650 | var i; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 651 | var noteholder = document.getElementById("footnotes"); |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 652 | if (!noteholder) { |
| 653 | return; |
| 654 | } |
| 655 | var entriesToRemove = []; |
| 656 | for (i = 0; i < noteholder.childNodes.length; i++) { |
| 657 | var entry = noteholder.childNodes[i]; |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 658 | if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote") |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 659 | entriesToRemove.push(entry); |
| 660 | } |
| 661 | for (i = 0; i < entriesToRemove.length; i++) { |
| 662 | noteholder.removeChild(entriesToRemove[i]); |
| 663 | } |
| 664 | |
| 665 | // Rebuild footnote entries. |
| 666 | var cont = document.getElementById("content"); |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 667 | var spans = cont.getElementsByTagName("span"); |
| 668 | var refs = {}; |
| 669 | var n = 0; |
| 670 | for (i=0; i<spans.length; i++) { |
| 671 | if (spans[i].className == "footnote") { |
| 672 | n++; |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 673 | var note = spans[i].getAttribute("data-note"); |
| 674 | if (!note) { |
| 675 | // Use [\s\S] in place of . so multi-line matches work. |
| 676 | // Because JavaScript has no s (dotall) regex flag. |
| 677 | note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1]; |
| 678 | spans[i].innerHTML = |
| 679 | "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n + |
| 680 | "' title='View footnote' class='footnote'>" + n + "</a>]"; |
| 681 | spans[i].setAttribute("data-note", note); |
| 682 | } |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 683 | noteholder.innerHTML += |
| 684 | "<div class='footnote' id='_footnote_" + n + "'>" + |
| 685 | "<a href='#_footnoteref_" + n + "' title='Return to text'>" + |
| 686 | n + "</a>. " + note + "</div>"; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 687 | var id =spans[i].getAttribute("id"); |
| 688 | if (id != null) refs["#"+id] = n; |
| 689 | } |
| 690 | } |
| 691 | if (n == 0) |
| 692 | noteholder.parentNode.removeChild(noteholder); |
| 693 | else { |
| 694 | // Process footnoterefs. |
| 695 | for (i=0; i<spans.length; i++) { |
| 696 | if (spans[i].className == "footnoteref") { |
| 697 | var href = spans[i].getElementsByTagName("a")[0].getAttribute("href"); |
| 698 | href = href.match(/#.*/)[0]; // Because IE return full URL. |
| 699 | n = refs[href]; |
| 700 | spans[i].innerHTML = |
| 701 | "[<a href='#_footnote_" + n + |
| 702 | "' title='View footnote' class='footnote'>" + n + "</a>]"; |
| 703 | } |
| 704 | } |
| 705 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 706 | }, |
| 707 | |
| 708 | install: function(toclevels) { |
| 709 | var timerId; |
| 710 | |
| 711 | function reinstall() { |
| 712 | asciidoc.footnotes(); |
| 713 | if (toclevels) { |
| 714 | asciidoc.toc(toclevels); |
| 715 | } |
| 716 | } |
| 717 | |
| 718 | function reinstallAndRemoveTimer() { |
| 719 | clearInterval(timerId); |
| 720 | reinstall(); |
| 721 | } |
| 722 | |
| 723 | timerId = setInterval(reinstall, 500); |
| 724 | if (document.addEventListener) |
| 725 | document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false); |
| 726 | else |
| 727 | window.onload = reinstallAndRemoveTimer; |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 728 | } |
| 729 | |
| 730 | } |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 731 | asciidoc.install(); |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 732 | /*]]>*/ |
| 733 | </script> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 734 | </head> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 735 | <body class="manpage"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 736 | <div id="header"> |
| 737 | <h1> |
| 738 | git-reset(1) Manual Page |
| 739 | </h1> |
| 740 | <h2>NAME</h2> |
| 741 | <div class="sectionbody"> |
| 742 | <p>git-reset - |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 743 | Reset current HEAD to the specified state |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 744 | </p> |
| 745 | </div> |
| 746 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 747 | <div id="content"> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 748 | <div class="sect1"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 749 | <h2 id="_synopsis">SYNOPSIS</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 750 | <div class="sectionbody"> |
Junio C Hamano | d793de5 | 2006-12-26 09:11:43 | [diff] [blame] | 751 | <div class="verseblock"> |
Junio C Hamano | e77c5d0 | 2013-01-22 19:19:59 | [diff] [blame] | 752 | <pre class="content"><em>git reset</em> [-q] [<tree-ish>] [--] <paths>… |
Junio C Hamano | 4e1d0cb | 2013-07-19 20:43:00 | [diff] [blame] | 753 | <em>git reset</em> (--patch | -p) [<tree-ish>] [--] [<paths>…] |
Junio C Hamano | 5b3533d | 2014-02-27 23:07:15 | [diff] [blame] | 754 | <em>git reset</em> [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>]</pre> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 755 | <div class="attribution"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 756 | </div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 757 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 758 | </div> |
| 759 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 760 | <h2 id="_description">DESCRIPTION</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 761 | <div class="sectionbody"> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 762 | <div class="paragraph"><p>In the first and second form, copy entries from <code><tree-ish></code> to the index. |
| 763 | In the third form, set the current branch head (<code>HEAD</code>) to <code><commit></code>, |
| 764 | optionally modifying index and working tree to match. |
| 765 | The <code><tree-ish></code>/<code><commit></code> defaults to <code>HEAD</code> in all forms.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 766 | <div class="dlist"><dl> |
| 767 | <dt class="hdlist1"> |
Junio C Hamano | e77c5d0 | 2013-01-22 19:19:59 | [diff] [blame] | 768 | <em>git reset</em> [-q] [<tree-ish>] [--] <paths>… |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 769 | </dt> |
| 770 | <dd> |
| 771 | <p> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 772 | This form resets the index entries for all <code><paths></code> to their |
| 773 | state at <code><tree-ish></code>. (It does not affect the working tree or |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 774 | the current branch.) |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 775 | </p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 776 | <div class="paragraph"><p>This means that <code>git reset <paths></code> is the opposite of <code>git add |
| 777 | <paths></code>.</p></div> |
| 778 | <div class="paragraph"><p>After running <code>git reset <paths></code> to update the index entry, you can |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 779 | use <a href="git-checkout.html">git-checkout(1)</a> to check the contents out of the index to |
Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 780 | the working tree. |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 781 | Alternatively, using <a href="git-checkout.html">git-checkout(1)</a> and specifying a commit, you |
Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 782 | can copy the contents of a path out of a commit to the index and to the |
| 783 | working tree in one go.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 784 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 785 | <dt class="hdlist1"> |
Junio C Hamano | e77c5d0 | 2013-01-22 19:19:59 | [diff] [blame] | 786 | <em>git reset</em> (--patch | -p) [<tree-ish>] [--] [<paths>…] |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 787 | </dt> |
| 788 | <dd> |
| 789 | <p> |
| 790 | Interactively select hunks in the difference between the index |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 791 | and <code><tree-ish></code> (defaults to <code>HEAD</code>). The chosen hunks are applied |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 792 | in reverse to the index. |
| 793 | </p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 794 | <div class="paragraph"><p>This means that <code>git reset -p</code> is the opposite of <code>git add -p</code>, i.e. |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 795 | you can use it to selectively reset hunks. See the “Interactive Mode” |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 796 | section of <a href="git-add.html">git-add(1)</a> to learn how to operate the <code>--patch</code> mode.</p></div> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 797 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 798 | <dt class="hdlist1"> |
Junio C Hamano | a129545 | 2012-11-13 22:32:04 | [diff] [blame] | 799 | <em>git reset</em> [<mode>] [<commit>] |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 800 | </dt> |
| 801 | <dd> |
| 802 | <p> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 803 | This form resets the current branch head to <code><commit></code> and |
| 804 | possibly updates the index (resetting it to the tree of <code><commit></code>) and |
| 805 | the working tree depending on <code><mode></code>. If <code><mode></code> is omitted, |
| 806 | defaults to <code>--mixed</code>. The <code><mode></code> must be one of the following: |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 807 | </p> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 808 | <div class="openblock"> |
| 809 | <div class="content"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 810 | <div class="dlist"><dl> |
| 811 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 812 | --soft |
| 813 | </dt> |
| 814 | <dd> |
| 815 | <p> |
Junio C Hamano | d75148a | 2014-04-08 19:48:38 | [diff] [blame] | 816 | Does not touch the index file or the working tree at all (but |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 817 | resets the head to <code><commit></code>, just like all modes do). This leaves |
| 818 | all your changed files "Changes to be committed", as <code>git status</code> |
Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 819 | would put it. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 820 | </p> |
| 821 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 822 | <dt class="hdlist1"> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 823 | --mixed |
| 824 | </dt> |
| 825 | <dd> |
| 826 | <p> |
| 827 | Resets the index but not the working tree (i.e., the changed files |
| 828 | are preserved but not marked for commit) and reports what has not |
| 829 | been updated. This is the default action. |
| 830 | </p> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 831 | <div class="paragraph"><p>If <code>-N</code> is specified, removed paths are marked as intent-to-add (see |
Junio C Hamano | 5b3533d | 2014-02-27 23:07:15 | [diff] [blame] | 832 | <a href="git-add.html">git-add(1)</a>).</p></div> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 833 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 834 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 835 | --hard |
| 836 | </dt> |
| 837 | <dd> |
| 838 | <p> |
Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 839 | Resets the index and working tree. Any changes to tracked files in the |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 840 | working tree since <code><commit></code> are discarded. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 841 | </p> |
| 842 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 843 | <dt class="hdlist1"> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 844 | --merge |
| 845 | </dt> |
| 846 | <dd> |
| 847 | <p> |
Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 848 | Resets the index and updates the files in the working tree that are |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 849 | different between <code><commit></code> and <code>HEAD</code>, but keeps those which are |
Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 850 | different between the index and working tree (i.e. which have changes |
| 851 | which have not been added). |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 852 | If a file that is different between <code><commit></code> and the index has |
| 853 | unstaged changes, reset is aborted. |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 854 | </p> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 855 | <div class="paragraph"><p>In other words, <code>--merge</code> does something like a <code>git read-tree -u -m <commit></code>, |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 856 | but carries forward unmerged index entries.</p></div> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 857 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 858 | <dt class="hdlist1"> |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 859 | --keep |
| 860 | </dt> |
| 861 | <dd> |
| 862 | <p> |
Junio C Hamano | 20338b4 | 2011-01-22 00:51:59 | [diff] [blame] | 863 | Resets index entries and updates files in the working tree that are |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 864 | different between <code><commit></code> and <code>HEAD</code>. |
| 865 | If a file that is different between <code><commit></code> and <code>HEAD</code> has local |
| 866 | changes, reset is aborted. |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 867 | </p> |
| 868 | </dd> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 869 | </dl></div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 870 | </div></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 871 | </dd> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 872 | </dl></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 873 | <div class="paragraph"><p>If you want to undo a commit other than the latest on a branch, |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 874 | <a href="git-revert.html">git-revert(1)</a> is your friend.</p></div> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 875 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 876 | </div> |
| 877 | <div class="sect1"> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 878 | <h2 id="_options">OPTIONS</h2> |
| 879 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 880 | <div class="dlist"><dl> |
| 881 | <dt class="hdlist1"> |
Junio C Hamano | 422cfec | 2007-11-08 08:07:45 | [diff] [blame] | 882 | -q |
| 883 | </dt> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 884 | <dt class="hdlist1"> |
Junio C Hamano | b141a92 | 2010-01-10 19:55:14 | [diff] [blame] | 885 | --quiet |
| 886 | </dt> |
Junio C Hamano | 06ce83b | 2018-11-13 14:06:12 | [diff] [blame] | 887 | <dt class="hdlist1"> |
| 888 | --no-quiet |
| 889 | </dt> |
Junio C Hamano | 422cfec | 2007-11-08 08:07:45 | [diff] [blame] | 890 | <dd> |
| 891 | <p> |
Junio C Hamano | 06ce83b | 2018-11-13 14:06:12 | [diff] [blame] | 892 | Be quiet, only report errors. The default behavior is set by the |
| 893 | <code>reset.quiet</code> config option. <code>--quiet</code> and <code>--no-quiet</code> will |
| 894 | override the default behavior. |
Junio C Hamano | 422cfec | 2007-11-08 08:07:45 | [diff] [blame] | 895 | </p> |
| 896 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 897 | </dl></div> |
Junio C Hamano | 1bb569e | 2006-05-05 23:14:25 | [diff] [blame] | 898 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 899 | </div> |
| 900 | <div class="sect1"> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 901 | <h2 id="_examples">EXAMPLES</h2> |
Junio C Hamano | 1bb569e | 2006-05-05 23:14:25 | [diff] [blame] | 902 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 903 | <div class="dlist"><dl> |
| 904 | <dt class="hdlist1"> |
Junio C Hamano | 89d4e0f | 2007-02-18 00:34:59 | [diff] [blame] | 905 | Undo add |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 906 | </dt> |
| 907 | <dd> |
| 908 | <div class="listingblock"> |
| 909 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 910 | <pre><code>$ edit <b><1></b> |
Junio C Hamano | 89d4e0f | 2007-02-18 00:34:59 | [diff] [blame] | 911 | $ git add frotz.c filfre.c |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 912 | $ mailx <b><2></b> |
| 913 | $ git reset <b><3></b> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 914 | $ git pull git://info.example.com/ nitfol <b><4></b></code></pre> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 915 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 916 | <div class="colist arabic"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 917 | <li> |
| 918 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 919 | You are happily working on something, and find the changes |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 920 | in these files are in good order. You do not want to see them |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 921 | when you run <code>git diff</code>, because you plan to work on other files |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 922 | and changes with these files are distracting. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 923 | </p> |
| 924 | </li> |
| 925 | <li> |
| 926 | <p> |
Junio C Hamano | 535c65c | 2017-06-24 22:51:58 | [diff] [blame] | 927 | Somebody asks you to pull, and the changes sound worthy of merging. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 928 | </p> |
| 929 | </li> |
| 930 | <li> |
| 931 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 932 | However, you already dirtied the index (i.e. your index does |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 933 | not match the <code>HEAD</code> commit). But you know the pull you are going |
| 934 | to make does not affect <code>frotz.c</code> or <code>filfre.c</code>, so you revert the |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 935 | index changes for these two files. Your changes in working tree |
| 936 | remain there. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 937 | </p> |
| 938 | </li> |
| 939 | <li> |
| 940 | <p> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 941 | Then you can pull and merge, leaving <code>frotz.c</code> and <code>filfre.c</code> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 942 | changes still in the working tree. |
| 943 | </p> |
| 944 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 945 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 946 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 947 | <dt class="hdlist1"> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 948 | Undo a commit and redo |
| 949 | </dt> |
| 950 | <dd> |
| 951 | <div class="listingblock"> |
| 952 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 953 | <pre><code>$ git commit ... |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 954 | $ git reset --soft HEAD^ <b><1></b> |
| 955 | $ edit <b><2></b> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 956 | $ git commit -a -c ORIG_HEAD <b><3></b></code></pre> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 957 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 958 | <div class="colist arabic"><ol> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 959 | <li> |
| 960 | <p> |
| 961 | This is most often done when you remembered what you |
| 962 | just committed is incomplete, or you misspelled your commit |
| 963 | message, or both. Leaves working tree as it was before "reset". |
| 964 | </p> |
| 965 | </li> |
| 966 | <li> |
| 967 | <p> |
| 968 | Make corrections to working tree files. |
| 969 | </p> |
| 970 | </li> |
| 971 | <li> |
| 972 | <p> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 973 | "reset" copies the old head to <code>.git/ORIG_HEAD</code>; redo the |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 974 | commit by starting with its log message. If you do not need to |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 975 | edit the message further, you can give <code>-C</code> option instead. |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 976 | </p> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 977 | <div class="paragraph"><p>See also the <code>--amend</code> option to <a href="git-commit.html">git-commit(1)</a>.</p></div> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 978 | </li> |
| 979 | </ol></div> |
| 980 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 981 | <dt class="hdlist1"> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 982 | Undo a commit, making it a topic branch |
| 983 | </dt> |
| 984 | <dd> |
| 985 | <div class="listingblock"> |
| 986 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 987 | <pre><code>$ git branch topic/wip <b><1></b> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 988 | $ git reset --hard HEAD~3 <b><2></b> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 989 | $ git checkout topic/wip <b><3></b></code></pre> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 990 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 991 | <div class="colist arabic"><ol> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 992 | <li> |
| 993 | <p> |
| 994 | You have made some commits, but realize they were premature |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 995 | to be in the <code>master</code> branch. You want to continue polishing |
| 996 | them in a topic branch, so create <code>topic/wip</code> branch off of the |
| 997 | current <code>HEAD</code>. |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 998 | </p> |
| 999 | </li> |
| 1000 | <li> |
| 1001 | <p> |
| 1002 | Rewind the master branch to get rid of those three commits. |
| 1003 | </p> |
| 1004 | </li> |
| 1005 | <li> |
| 1006 | <p> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1007 | Switch to <code>topic/wip</code> branch and keep working. |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1008 | </p> |
| 1009 | </li> |
| 1010 | </ol></div> |
| 1011 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1012 | <dt class="hdlist1"> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1013 | Undo commits permanently |
| 1014 | </dt> |
| 1015 | <dd> |
| 1016 | <div class="listingblock"> |
| 1017 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1018 | <pre><code>$ git commit ... |
| 1019 | $ git reset --hard HEAD~3 <b><1></b></code></pre> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1020 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1021 | <div class="colist arabic"><ol> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1022 | <li> |
| 1023 | <p> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1024 | The last three commits (<code>HEAD</code>, <code>HEAD^</code>, and <code>HEAD~2</code>) were bad |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1025 | and you do not want to ever see them again. Do <strong>not</strong> do this if |
| 1026 | you have already given these commits to somebody else. (See the |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1027 | "RECOVERING FROM UPSTREAM REBASE" section in <a href="git-rebase.html">git-rebase(1)</a> for |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1028 | the implications of doing so.) |
| 1029 | </p> |
| 1030 | </li> |
| 1031 | </ol></div> |
| 1032 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1033 | <dt class="hdlist1"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1034 | Undo a merge or pull |
| 1035 | </dt> |
| 1036 | <dd> |
| 1037 | <div class="listingblock"> |
| 1038 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1039 | <pre><code>$ git pull <b><1></b> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1040 | Auto-merging nitfol |
| 1041 | CONFLICT (content): Merge conflict in nitfol |
Junio C Hamano | 6a3c827 | 2008-12-19 21:38:18 | [diff] [blame] | 1042 | Automatic merge failed; fix conflicts and then commit the result. |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1043 | $ git reset --hard <b><2></b> |
| 1044 | $ git pull . topic/branch <b><3></b> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1045 | Updating from 41223... to 13134... |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame] | 1046 | Fast-forward |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1047 | $ git reset --hard ORIG_HEAD <b><4></b></code></pre> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1048 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1049 | <div class="colist arabic"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1050 | <li> |
| 1051 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1052 | Try to update from the upstream resulted in a lot of |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1053 | conflicts; you were not ready to spend a lot of time merging |
| 1054 | right now, so you decide to do that later. |
| 1055 | </p> |
| 1056 | </li> |
| 1057 | <li> |
| 1058 | <p> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1059 | "pull" has not made merge commit, so <code>git reset --hard</code> |
| 1060 | which is a synonym for <code>git reset --hard HEAD</code> clears the mess |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1061 | from the index file and the working tree. |
| 1062 | </p> |
| 1063 | </li> |
| 1064 | <li> |
| 1065 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1066 | Merge a topic branch into the current branch, which resulted |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame] | 1067 | in a fast-forward. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1068 | </p> |
| 1069 | </li> |
| 1070 | <li> |
| 1071 | <p> |
Junio C Hamano | 092f5f0 | 2007-08-02 07:23:38 | [diff] [blame] | 1072 | But you decided that the topic branch is not ready for public |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1073 | consumption yet. "pull" or "merge" always leaves the original |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1074 | tip of the current branch in <code>ORIG_HEAD</code>, so resetting hard to it |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1075 | brings your index file and the working tree back to that state, |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1076 | and resets the tip of the branch to that commit. |
| 1077 | </p> |
| 1078 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1079 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1080 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1081 | <dt class="hdlist1"> |
Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 1082 | Undo a merge or pull inside a dirty working tree |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 1083 | </dt> |
| 1084 | <dd> |
| 1085 | <div class="listingblock"> |
| 1086 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1087 | <pre><code>$ git pull <b><1></b> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 1088 | Auto-merging nitfol |
| 1089 | Merge made by recursive. |
| 1090 | nitfol | 20 +++++---- |
| 1091 | ... |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1092 | $ git reset --merge ORIG_HEAD <b><2></b></code></pre> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 1093 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1094 | <div class="colist arabic"><ol> |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 1095 | <li> |
| 1096 | <p> |
| 1097 | Even if you may have local modifications in your |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1098 | working tree, you can safely say <code>git pull</code> when you know |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 1099 | that the change in the other branch does not overlap with |
| 1100 | them. |
| 1101 | </p> |
| 1102 | </li> |
| 1103 | <li> |
| 1104 | <p> |
| 1105 | After inspecting the result of the merge, you may find |
| 1106 | that the change in the other branch is unsatisfactory. Running |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1107 | <code>git reset --hard ORIG_HEAD</code> will let you go back to where you |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 1108 | were, but it will discard your local changes, which you do not |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1109 | want. <code>git reset --merge</code> keeps your local changes. |
Junio C Hamano | bbbb865 | 2008-12-29 10:34:22 | [diff] [blame] | 1110 | </p> |
| 1111 | </li> |
| 1112 | </ol></div> |
| 1113 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1114 | <dt class="hdlist1"> |
Junio C Hamano | 74e8a2d | 2006-01-14 03:58:41 | [diff] [blame] | 1115 | Interrupted workflow |
| 1116 | </dt> |
| 1117 | <dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1118 | <div class="paragraph"><p>Suppose you are interrupted by an urgent fix request while you |
Junio C Hamano | a6331a8 | 2006-01-22 07:50:33 | [diff] [blame] | 1119 | are in the middle of a large change. The files in your |
Junio C Hamano | 74e8a2d | 2006-01-14 03:58:41 | [diff] [blame] | 1120 | working tree are not in any shape to be committed yet, but you |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1121 | need to get to the other branch for a quick bugfix.</p></div> |
Junio C Hamano | 74e8a2d | 2006-01-14 03:58:41 | [diff] [blame] | 1122 | <div class="listingblock"> |
| 1123 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1124 | <pre><code>$ git checkout feature ;# you were working in "feature" branch and |
Junio C Hamano | 74e8a2d | 2006-01-14 03:58:41 | [diff] [blame] | 1125 | $ work work work ;# got interrupted |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1126 | $ git commit -a -m "snapshot WIP" <b><1></b> |
Junio C Hamano | 74e8a2d | 2006-01-14 03:58:41 | [diff] [blame] | 1127 | $ git checkout master |
| 1128 | $ fix fix fix |
| 1129 | $ git commit ;# commit with real log |
| 1130 | $ git checkout feature |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1131 | $ git reset --soft HEAD^ ;# go back to WIP state <b><2></b> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1132 | $ git reset <b><3></b></code></pre> |
Junio C Hamano | 74e8a2d | 2006-01-14 03:58:41 | [diff] [blame] | 1133 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1134 | <div class="colist arabic"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1135 | <li> |
| 1136 | <p> |
| 1137 | This commit will get blown away so a throw-away log message is OK. |
| 1138 | </p> |
| 1139 | </li> |
| 1140 | <li> |
| 1141 | <p> |
| 1142 | This removes the <em>WIP</em> commit from the commit history, and sets |
| 1143 | your working tree to the state just before you made that snapshot. |
| 1144 | </p> |
| 1145 | </li> |
| 1146 | <li> |
| 1147 | <p> |
| 1148 | At this point the index file still has all the WIP changes you |
| 1149 | committed as <em>snapshot WIP</em>. This updates the index to show your |
| 1150 | WIP files as uncommitted. |
| 1151 | </p> |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1152 | <div class="paragraph"><p>See also <a href="git-stash.html">git-stash(1)</a>.</p></div> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1153 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1154 | </ol></div> |
Junio C Hamano | 74e8a2d | 2006-01-14 03:58:41 | [diff] [blame] | 1155 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1156 | <dt class="hdlist1"> |
Junio C Hamano | 26e590a | 2008-02-17 03:53:51 | [diff] [blame] | 1157 | Reset a single file in the index |
| 1158 | </dt> |
| 1159 | <dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1160 | <div class="paragraph"><p>Suppose you have added a file to your index, but later decide you do not |
Junio C Hamano | 26e590a | 2008-02-17 03:53:51 | [diff] [blame] | 1161 | want to add it to your commit. You can remove the file from the index |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1162 | while keeping your changes with git reset.</p></div> |
Junio C Hamano | 26e590a | 2008-02-17 03:53:51 | [diff] [blame] | 1163 | <div class="listingblock"> |
| 1164 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1165 | <pre><code>$ git reset -- frotz.c <b><1></b> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1166 | $ git commit -m "Commit files in index" <b><2></b> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1167 | $ git add frotz.c <b><3></b></code></pre> |
Junio C Hamano | 26e590a | 2008-02-17 03:53:51 | [diff] [blame] | 1168 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1169 | <div class="colist arabic"><ol> |
Junio C Hamano | 26e590a | 2008-02-17 03:53:51 | [diff] [blame] | 1170 | <li> |
| 1171 | <p> |
| 1172 | This removes the file from the index while keeping it in the working |
| 1173 | directory. |
| 1174 | </p> |
| 1175 | </li> |
| 1176 | <li> |
| 1177 | <p> |
| 1178 | This commits all other changes in the index. |
| 1179 | </p> |
| 1180 | </li> |
| 1181 | <li> |
| 1182 | <p> |
| 1183 | Adds the file to the index again. |
| 1184 | </p> |
| 1185 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1186 | </ol></div> |
Junio C Hamano | 26e590a | 2008-02-17 03:53:51 | [diff] [blame] | 1187 | </dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1188 | <dt class="hdlist1"> |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 1189 | Keep changes in working tree while discarding some previous commits |
| 1190 | </dt> |
| 1191 | <dd> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1192 | <div class="paragraph"><p>Suppose you are working on something and you commit it, and then you |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 1193 | continue working a bit more, but now you think that what you have in |
| 1194 | your working tree should be in another branch that has nothing to do |
Junio C Hamano | 619596a | 2010-08-18 22:15:35 | [diff] [blame] | 1195 | with what you committed previously. You can start a new branch and |
Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 1196 | reset it while keeping the changes in your working tree.</p></div> |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 1197 | <div class="listingblock"> |
| 1198 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1199 | <pre><code>$ git tag start |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 1200 | $ git checkout -b branch1 |
| 1201 | $ edit |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1202 | $ git commit ... <b><1></b> |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 1203 | $ edit |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1204 | $ git checkout -b branch2 <b><2></b> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1205 | $ git reset --keep start <b><3></b></code></pre> |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 1206 | </div></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1207 | <div class="colist arabic"><ol> |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 1208 | <li> |
| 1209 | <p> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1210 | This commits your first edits in <code>branch1</code>. |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 1211 | </p> |
| 1212 | </li> |
| 1213 | <li> |
| 1214 | <p> |
| 1215 | In the ideal world, you could have realized that the earlier |
| 1216 | commit did not belong to the new topic when you created and switched |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1217 | to <code>branch2</code> (i.e. <code>git checkout -b branch2 start</code>), but nobody is |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 1218 | perfect. |
| 1219 | </p> |
| 1220 | </li> |
| 1221 | <li> |
| 1222 | <p> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1223 | But you can use <code>reset --keep</code> to remove the unwanted commit after |
| 1224 | you switched to <code>branch2</code>. |
Junio C Hamano | 0299d92 | 2010-03-20 20:59:31 | [diff] [blame] | 1225 | </p> |
| 1226 | </li> |
| 1227 | </ol></div> |
| 1228 | </dd> |
Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1229 | <dt class="hdlist1"> |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1230 | Split a commit apart into a sequence of commits |
Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1231 | </dt> |
| 1232 | <dd> |
Junio C Hamano | 967cda7 | 2017-06-30 21:49:53 | [diff] [blame] | 1233 | <div class="paragraph"><p>Suppose that you have created lots of logically separate changes and committed |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1234 | them together. Then, later you decide that it might be better to have each |
| 1235 | logical chunk associated with its own commit. You can use git reset to rewind |
| 1236 | history without changing the contents of your local files, and then successively |
| 1237 | use <code>git add -p</code> to interactively select which hunks to include into each commit, |
| 1238 | using <code>git commit -c</code> to pre-populate the commit message.</p></div> |
Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1239 | <div class="listingblock"> |
| 1240 | <div class="content"> |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1241 | <pre><code>$ git reset -N HEAD^ <b><1></b> |
Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1242 | $ git add -p <b><2></b> |
| 1243 | $ git diff --cached <b><3></b> |
| 1244 | $ git commit -c HEAD@{1} <b><4></b> |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1245 | ... <b><5></b> |
| 1246 | $ git add ... <b><6></b> |
| 1247 | $ git diff --cached <b><7></b> |
| 1248 | $ git commit ... <b><8></b></code></pre> |
Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1249 | </div></div> |
| 1250 | <div class="colist arabic"><ol> |
| 1251 | <li> |
| 1252 | <p> |
| 1253 | First, reset the history back one commit so that we remove the original |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1254 | commit, but leave the working tree with all the changes. The -N ensures |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1255 | that any new files added with <code>HEAD</code> are still marked so that <code>git add -p</code> |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1256 | will find them. |
Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1257 | </p> |
| 1258 | </li> |
| 1259 | <li> |
| 1260 | <p> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1261 | Next, we interactively select diff hunks to add using the <code>git add -p</code> |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1262 | facility. This will ask you about each diff hunk in sequence and you can |
| 1263 | use simple commands such as "yes, include this", "No don’t include this" |
| 1264 | or even the very powerful "edit" facility. |
Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1265 | </p> |
| 1266 | </li> |
| 1267 | <li> |
| 1268 | <p> |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1269 | Once satisfied with the hunks you want to include, you should verify what |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1270 | has been prepared for the first commit by using <code>git diff --cached</code>. This |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1271 | shows all the changes that have been moved into the index and are about |
| 1272 | to be committed. |
Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1273 | </p> |
| 1274 | </li> |
| 1275 | <li> |
| 1276 | <p> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1277 | Next, commit the changes stored in the index. The <code>-c</code> option specifies to |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1278 | pre-populate the commit message from the original message that you started |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1279 | with in the first commit. This is helpful to avoid retyping it. The |
| 1280 | <code>HEAD@{1}</code> is a special notation for the commit that <code>HEAD</code> used to be at |
| 1281 | prior to the original reset commit (1 change ago). |
| 1282 | See <a href="git-reflog.html">git-reflog(1)</a> for more details. You may also use any other |
| 1283 | valid commit reference. |
Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1284 | </p> |
| 1285 | </li> |
| 1286 | <li> |
| 1287 | <p> |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1288 | You can repeat steps 2-4 multiple times to break the original code into |
| 1289 | any number of commits. |
Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1290 | </p> |
| 1291 | </li> |
| 1292 | <li> |
| 1293 | <p> |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1294 | Now you’ve split out many of the changes into their own commits, and might |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1295 | no longer use the patch mode of <code>git add</code>, in order to select all remaining |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1296 | uncommitted changes. |
Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1297 | </p> |
| 1298 | </li> |
| 1299 | <li> |
| 1300 | <p> |
Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1301 | Once again, check to verify that you’ve included what you want to. You may |
| 1302 | also wish to verify that git diff doesn’t show any remaining changes to be |
| 1303 | committed later. |
| 1304 | </p> |
| 1305 | </li> |
| 1306 | <li> |
| 1307 | <p> |
| 1308 | And finally create the final commit. |
Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1309 | </p> |
| 1310 | </li> |
| 1311 | </ol></div> |
| 1312 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1313 | </dl></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1314 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1315 | </div> |
| 1316 | <div class="sect1"> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1317 | <h2 id="_discussion">DISCUSSION</h2> |
| 1318 | <div class="sectionbody"> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1319 | <div class="paragraph"><p>The tables below show what happens when running:</p></div> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1320 | <div class="listingblock"> |
| 1321 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1322 | <pre><code>git reset --option target</code></pre> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1323 | </div></div> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1324 | <div class="paragraph"><p>to reset the <code>HEAD</code> to another commit (<code>target</code>) with the different |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1325 | reset options depending on the state of the files.</p></div> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1326 | <div class="paragraph"><p>In these tables, <code>A</code>, <code>B</code>, <code>C</code> and <code>D</code> are some different states of a |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1327 | file. For example, the first line of the first table means that if a |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1328 | file is in state <code>A</code> in the working tree, in state <code>B</code> in the index, in |
| 1329 | state <code>C</code> in <code>HEAD</code> and in state <code>D</code> in the target, then <code>git reset --soft |
| 1330 | target</code> will leave the file in the working tree in state <code>A</code> and in the |
| 1331 | index in state <code>B</code>. It resets (i.e. moves) the <code>HEAD</code> (i.e. the tip of |
| 1332 | the current branch, if you are on one) to <code>target</code> (which has the file |
| 1333 | in state <code>D</code>).</p></div> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1334 | <div class="literalblock"> |
| 1335 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1336 | <pre><code>working index HEAD target working index HEAD |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1337 | ---------------------------------------------------- |
| 1338 | A B C D --soft A B D |
| 1339 | --mixed A D D |
| 1340 | --hard D D D |
| 1341 | --merge (disallowed) |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1342 | --keep (disallowed)</code></pre> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1343 | </div></div> |
| 1344 | <div class="literalblock"> |
| 1345 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1346 | <pre><code>working index HEAD target working index HEAD |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1347 | ---------------------------------------------------- |
| 1348 | A B C C --soft A B C |
| 1349 | --mixed A C C |
| 1350 | --hard C C C |
| 1351 | --merge (disallowed) |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1352 | --keep A C C</code></pre> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1353 | </div></div> |
| 1354 | <div class="literalblock"> |
| 1355 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1356 | <pre><code>working index HEAD target working index HEAD |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1357 | ---------------------------------------------------- |
| 1358 | B B C D --soft B B D |
| 1359 | --mixed B D D |
| 1360 | --hard D D D |
| 1361 | --merge D D D |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1362 | --keep (disallowed)</code></pre> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1363 | </div></div> |
| 1364 | <div class="literalblock"> |
| 1365 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1366 | <pre><code>working index HEAD target working index HEAD |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1367 | ---------------------------------------------------- |
| 1368 | B B C C --soft B B C |
| 1369 | --mixed B C C |
| 1370 | --hard C C C |
| 1371 | --merge C C C |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1372 | --keep B C C</code></pre> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1373 | </div></div> |
| 1374 | <div class="literalblock"> |
| 1375 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1376 | <pre><code>working index HEAD target working index HEAD |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1377 | ---------------------------------------------------- |
| 1378 | B C C D --soft B C D |
| 1379 | --mixed B D D |
| 1380 | --hard D D D |
| 1381 | --merge (disallowed) |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1382 | --keep (disallowed)</code></pre> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1383 | </div></div> |
| 1384 | <div class="literalblock"> |
| 1385 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1386 | <pre><code>working index HEAD target working index HEAD |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1387 | ---------------------------------------------------- |
| 1388 | B C C C --soft B C C |
| 1389 | --mixed B C C |
| 1390 | --hard C C C |
| 1391 | --merge B C C |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1392 | --keep B C C</code></pre> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1393 | </div></div> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1394 | <div class="paragraph"><p><code>reset --merge</code> is meant to be used when resetting out of a conflicted |
Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 1395 | merge. Any mergy operation guarantees that the working tree file that is |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1396 | involved in the merge does not have local change wrt the index before |
Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 1397 | it starts, and that it writes the result out to the working tree. So if |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1398 | we see some difference between the index and the target and also |
Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 1399 | between the index and the working tree, then it means that we are not |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1400 | resetting out from a state that a mergy operation left after failing |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1401 | with a conflict. That is why we disallow <code>--merge</code> option in this case.</p></div> |
| 1402 | <div class="paragraph"><p><code>reset --keep</code> is meant to be used when removing some of the last |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1403 | commits in the current branch while keeping changes in the working |
| 1404 | tree. If there could be conflicts between the changes in the commit we |
| 1405 | want to remove and the changes in the working tree we want to keep, |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1406 | the reset is disallowed. That’s why it is disallowed if there are both |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1407 | changes between the working tree and <code>HEAD</code>, and between <code>HEAD</code> and the |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1408 | target. To be safe, it is also disallowed when there are unmerged |
| 1409 | entries.</p></div> |
Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1410 | <div class="paragraph"><p>The following tables show what happens when there are unmerged |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1411 | entries:</p></div> |
| 1412 | <div class="literalblock"> |
| 1413 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1414 | <pre><code>working index HEAD target working index HEAD |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1415 | ---------------------------------------------------- |
| 1416 | X U A B --soft (disallowed) |
| 1417 | --mixed X B B |
| 1418 | --hard B B B |
| 1419 | --merge B B B |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1420 | --keep (disallowed)</code></pre> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1421 | </div></div> |
| 1422 | <div class="literalblock"> |
| 1423 | <div class="content"> |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1424 | <pre><code>working index HEAD target working index HEAD |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1425 | ---------------------------------------------------- |
| 1426 | X U A A --soft (disallowed) |
| 1427 | --mixed X A A |
| 1428 | --hard A A A |
| 1429 | --merge A A A |
Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1430 | --keep (disallowed)</code></pre> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1431 | </div></div> |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1432 | <div class="paragraph"><p><code>X</code> means any state and <code>U</code> means an unmerged index.</p></div> |
Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1433 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1434 | </div> |
| 1435 | <div class="sect1"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1436 | <h2 id="_git">GIT</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1437 | <div class="sectionbody"> |
Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1438 | <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] | 1439 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 1440 | </div> |
Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1441 | </div> |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 1442 | <div id="footnotes"><hr /></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1443 | <div id="footer"> |
| 1444 | <div id="footer-text"> |
Junio C Hamano | 2ef0ba3 | 2018-01-26 23:13:53 | [diff] [blame] | 1445 | Last updated |
Junio C Hamano | f2b280b | 2018-12-01 14:45:01 | [diff] [blame^] | 1446 | 2018-12-01 23:35:58 JST |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1447 | </div> |
| 1448 | </div> |
| 1449 | </body> |
| 1450 | </html> |