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