| 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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 8.6.9" /> | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 7 | <title>git-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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 90 | .monospaced, code, pre { | 
|  | 91 | font-family: "Courier New", Courier, monospace; | 
|  | 92 | font-size: inherit; | 
|  | 93 | color: navy; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 94 | padding: 0; | 
|  | 95 | margin: 0; | 
|  | 96 | } | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 97 | pre { | 
|  | 98 | white-space: pre-wrap; | 
|  | 99 | } | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 100 |  | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 101 | #author { | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 102 | color: #527bbd; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 103 | font-weight: bold; | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 104 | font-size: 1.1em; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 105 | } | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 106 | #email { | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 107 | } | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 108 | #revnumber, #revdate, #revremark { | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 109 | } | 
|  | 110 |  | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 111 | #footer { | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 112 | font-size: small; | 
|  | 113 | border-top: 2px solid silver; | 
|  | 114 | padding-top: 0.5em; | 
|  | 115 | margin-top: 4.0em; | 
|  | 116 | } | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 117 | #footer-text { | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 118 | float: left; | 
|  | 119 | padding-bottom: 0.5em; | 
|  | 120 | } | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 121 | #footer-badges { | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 122 | float: right; | 
|  | 123 | padding-bottom: 0.5em; | 
|  | 124 | } | 
|  | 125 |  | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 126 | #preamble { | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 127 | margin-top: 1.5em; | 
|  | 128 | margin-bottom: 1.5em; | 
|  | 129 | } | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 130 | div.imageblock, div.exampleblock, div.verseblock, | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 131 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, | 
|  | 132 | div.admonitionblock { | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 133 | margin-top: 1.0em; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 134 | margin-bottom: 1.5em; | 
|  | 135 | } | 
|  | 136 | div.admonitionblock { | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 137 | margin-top: 2.0em; | 
|  | 138 | margin-bottom: 2.0em; | 
|  | 139 | margin-right: 10%; | 
|  | 140 | color: #606060; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 141 | } | 
|  | 142 |  | 
|  | 143 | div.content { /* Block element content. */ | 
|  | 144 | padding: 0; | 
|  | 145 | } | 
|  | 146 |  | 
|  | 147 | /* Block element titles. */ | 
|  | 148 | div.title, caption.title { | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 149 | color: #527bbd; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 150 | font-weight: bold; | 
|  | 151 | text-align: left; | 
|  | 152 | margin-top: 1.0em; | 
|  | 153 | margin-bottom: 0.5em; | 
|  | 154 | } | 
|  | 155 | div.title + * { | 
|  | 156 | margin-top: 0; | 
|  | 157 | } | 
|  | 158 |  | 
|  | 159 | td div.title:first-child { | 
|  | 160 | margin-top: 0.0em; | 
|  | 161 | } | 
|  | 162 | div.content div.title:first-child { | 
|  | 163 | margin-top: 0.0em; | 
|  | 164 | } | 
|  | 165 | div.content + div.title { | 
|  | 166 | margin-top: 0.0em; | 
|  | 167 | } | 
|  | 168 |  | 
|  | 169 | div.sidebarblock > div.content { | 
|  | 170 | background: #ffffee; | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 171 | border: 1px solid #dddddd; | 
|  | 172 | border-left: 4px solid #f0f0f0; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 173 | padding: 0.5em; | 
|  | 174 | } | 
|  | 175 |  | 
|  | 176 | div.listingblock > div.content { | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 177 | border: 1px solid #dddddd; | 
|  | 178 | border-left: 5px solid #f0f0f0; | 
|  | 179 | background: #f8f8f8; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 180 | padding: 0.5em; | 
|  | 181 | } | 
|  | 182 |  | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 183 | div.quoteblock, div.verseblock { | 
|  | 184 | padding-left: 1.0em; | 
|  | 185 | margin-left: 1.0em; | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 186 | margin-right: 10%; | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 187 | border-left: 5px solid #f0f0f0; | 
|  | 188 | color: #888; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 189 | } | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 190 |  | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 191 | div.quoteblock > div.attribution { | 
|  | 192 | padding-top: 0.5em; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 193 | text-align: right; | 
|  | 194 | } | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 195 |  | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 196 | div.verseblock > pre.content { | 
|  | 197 | font-family: inherit; | 
|  | 198 | font-size: inherit; | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 199 | } | 
|  | 200 | div.verseblock > div.attribution { | 
|  | 201 | padding-top: 0.75em; | 
|  | 202 | text-align: left; | 
|  | 203 | } | 
|  | 204 | /* DEPRECATED: Pre version 8.2.7 verse style literal block. */ | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 205 | div.verseblock + div.attribution { | 
|  | 206 | text-align: left; | 
|  | 207 | } | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 208 |  | 
|  | 209 | div.admonitionblock .icon { | 
|  | 210 | vertical-align: top; | 
|  | 211 | font-size: 1.1em; | 
|  | 212 | font-weight: bold; | 
|  | 213 | text-decoration: underline; | 
|  | 214 | color: #527bbd; | 
|  | 215 | padding-right: 0.5em; | 
|  | 216 | } | 
|  | 217 | div.admonitionblock td.content { | 
|  | 218 | padding-left: 0.5em; | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 219 | border-left: 3px solid #dddddd; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 220 | } | 
|  | 221 |  | 
|  | 222 | div.exampleblock > div.content { | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 223 | border-left: 3px solid #dddddd; | 
|  | 224 | padding-left: 0.5em; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 225 | } | 
|  | 226 |  | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 227 | div.imageblock div.content { padding-left: 0; } | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 228 | span.image img { border-style: none; vertical-align: text-bottom; } | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 229 | a.image:visited { color: white; } | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 230 |  | 
|  | 231 | dl { | 
|  | 232 | margin-top: 0.8em; | 
|  | 233 | margin-bottom: 0.8em; | 
|  | 234 | } | 
|  | 235 | dt { | 
|  | 236 | margin-top: 0.5em; | 
|  | 237 | margin-bottom: 0; | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 238 | font-style: normal; | 
|  | 239 | color: navy; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 240 | } | 
|  | 241 | dd > *:first-child { | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 242 | margin-top: 0.1em; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 243 | } | 
|  | 244 |  | 
|  | 245 | ul, ol { | 
|  | 246 | list-style-position: outside; | 
|  | 247 | } | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 248 | ol.arabic { | 
|  | 249 | list-style-type: decimal; | 
|  | 250 | } | 
|  | 251 | ol.loweralpha { | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 252 | list-style-type: lower-alpha; | 
|  | 253 | } | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 254 | ol.upperalpha { | 
|  | 255 | list-style-type: upper-alpha; | 
|  | 256 | } | 
|  | 257 | ol.lowerroman { | 
|  | 258 | list-style-type: lower-roman; | 
|  | 259 | } | 
|  | 260 | ol.upperroman { | 
|  | 261 | list-style-type: upper-roman; | 
|  | 262 | } | 
|  | 263 |  | 
|  | 264 | div.compact ul, div.compact ol, | 
|  | 265 | div.compact p, div.compact p, | 
|  | 266 | div.compact div, div.compact div { | 
|  | 267 | margin-top: 0.1em; | 
|  | 268 | margin-bottom: 0.1em; | 
|  | 269 | } | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 270 |  | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 271 | tfoot { | 
|  | 272 | font-weight: bold; | 
|  | 273 | } | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 274 | td > div.verse { | 
|  | 275 | white-space: pre; | 
|  | 276 | } | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 277 |  | 
|  | 278 | div.hdlist { | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 279 | margin-top: 0.8em; | 
|  | 280 | margin-bottom: 0.8em; | 
|  | 281 | } | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 282 | div.hdlist tr { | 
|  | 283 | padding-bottom: 15px; | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 284 | } | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 285 | dt.hdlist1.strong, td.hdlist1.strong { | 
|  | 286 | font-weight: bold; | 
|  | 287 | } | 
|  | 288 | td.hdlist1 { | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 289 | vertical-align: top; | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 290 | font-style: normal; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 291 | padding-right: 0.8em; | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 292 | color: navy; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 293 | } | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 294 | td.hdlist2 { | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 295 | vertical-align: top; | 
|  | 296 | } | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 297 | div.hdlist.compact tr { | 
|  | 298 | margin: 0; | 
|  | 299 | padding-bottom: 0; | 
|  | 300 | } | 
|  | 301 |  | 
|  | 302 | .comment { | 
|  | 303 | background: yellow; | 
|  | 304 | } | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 305 |  | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 306 | .footnote, .footnoteref { | 
|  | 307 | font-size: 0.8em; | 
|  | 308 | } | 
|  | 309 |  | 
|  | 310 | span.footnote, span.footnoteref { | 
|  | 311 | vertical-align: super; | 
|  | 312 | } | 
|  | 313 |  | 
|  | 314 | #footnotes { | 
|  | 315 | margin: 20px 0 20px 0; | 
|  | 316 | padding: 7px 0 0 0; | 
|  | 317 | } | 
|  | 318 |  | 
|  | 319 | #footnotes div.footnote { | 
|  | 320 | margin: 0 0 5px 0; | 
|  | 321 | } | 
|  | 322 |  | 
|  | 323 | #footnotes hr { | 
|  | 324 | border: none; | 
|  | 325 | border-top: 1px solid silver; | 
|  | 326 | height: 1px; | 
|  | 327 | text-align: left; | 
|  | 328 | margin-left: 0; | 
|  | 329 | width: 20%; | 
|  | 330 | min-width: 100px; | 
|  | 331 | } | 
|  | 332 |  | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 333 | div.colist td { | 
|  | 334 | padding-right: 0.5em; | 
|  | 335 | padding-bottom: 0.3em; | 
|  | 336 | vertical-align: top; | 
|  | 337 | } | 
|  | 338 | div.colist td img { | 
|  | 339 | margin-top: 0.3em; | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 340 | } | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 341 |  | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 342 | @media print { | 
|  | 343 | #footer-badges { display: none; } | 
|  | 344 | } | 
|  | 345 |  | 
|  | 346 | #toc { | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 347 | margin-bottom: 2.5em; | 
|  | 348 | } | 
|  | 349 |  | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 350 | #toctitle { | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 351 | color: #527bbd; | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 352 | font-size: 1.1em; | 
|  | 353 | font-weight: bold; | 
|  | 354 | margin-top: 1.0em; | 
|  | 355 | margin-bottom: 0.1em; | 
|  | 356 | } | 
|  | 357 |  | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 358 | div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 359 | margin-top: 0; | 
|  | 360 | margin-bottom: 0; | 
|  | 361 | } | 
|  | 362 | div.toclevel2 { | 
|  | 363 | margin-left: 2em; | 
|  | 364 | font-size: 0.9em; | 
|  | 365 | } | 
|  | 366 | div.toclevel3 { | 
|  | 367 | margin-left: 4em; | 
|  | 368 | font-size: 0.9em; | 
|  | 369 | } | 
|  | 370 | div.toclevel4 { | 
|  | 371 | margin-left: 6em; | 
|  | 372 | font-size: 0.9em; | 
|  | 373 | } | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 374 |  | 
|  | 375 | span.aqua { color: aqua; } | 
|  | 376 | span.black { color: black; } | 
|  | 377 | span.blue { color: blue; } | 
|  | 378 | span.fuchsia { color: fuchsia; } | 
|  | 379 | span.gray { color: gray; } | 
|  | 380 | span.green { color: green; } | 
|  | 381 | span.lime { color: lime; } | 
|  | 382 | span.maroon { color: maroon; } | 
|  | 383 | span.navy { color: navy; } | 
|  | 384 | span.olive { color: olive; } | 
|  | 385 | span.purple { color: purple; } | 
|  | 386 | span.red { color: red; } | 
|  | 387 | span.silver { color: silver; } | 
|  | 388 | span.teal { color: teal; } | 
|  | 389 | span.white { color: white; } | 
|  | 390 | span.yellow { color: yellow; } | 
|  | 391 |  | 
|  | 392 | span.aqua-background { background: aqua; } | 
|  | 393 | span.black-background { background: black; } | 
|  | 394 | span.blue-background { background: blue; } | 
|  | 395 | span.fuchsia-background { background: fuchsia; } | 
|  | 396 | span.gray-background { background: gray; } | 
|  | 397 | span.green-background { background: green; } | 
|  | 398 | span.lime-background { background: lime; } | 
|  | 399 | span.maroon-background { background: maroon; } | 
|  | 400 | span.navy-background { background: navy; } | 
|  | 401 | span.olive-background { background: olive; } | 
|  | 402 | span.purple-background { background: purple; } | 
|  | 403 | span.red-background { background: red; } | 
|  | 404 | span.silver-background { background: silver; } | 
|  | 405 | span.teal-background { background: teal; } | 
|  | 406 | span.white-background { background: white; } | 
|  | 407 | span.yellow-background { background: yellow; } | 
|  | 408 |  | 
|  | 409 | span.big { font-size: 2em; } | 
|  | 410 | span.small { font-size: 0.6em; } | 
|  | 411 |  | 
|  | 412 | span.underline { text-decoration: underline; } | 
|  | 413 | span.overline { text-decoration: overline; } | 
|  | 414 | span.line-through { text-decoration: line-through; } | 
|  | 415 |  | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 416 | div.unbreakable { page-break-inside: avoid; } | 
|  | 417 |  | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 418 |  | 
|  | 419 | /* | 
|  | 420 | * xhtml11 specific | 
|  | 421 | * | 
|  | 422 | * */ | 
|  | 423 |  | 
|  | 424 | div.tableblock { | 
|  | 425 | margin-top: 1.0em; | 
|  | 426 | margin-bottom: 1.5em; | 
|  | 427 | } | 
|  | 428 | div.tableblock > table { | 
|  | 429 | border: 3px solid #527bbd; | 
|  | 430 | } | 
|  | 431 | thead, p.table.header { | 
|  | 432 | font-weight: bold; | 
|  | 433 | color: #527bbd; | 
|  | 434 | } | 
|  | 435 | p.table { | 
|  | 436 | margin-top: 0; | 
|  | 437 | } | 
|  | 438 | /* Because the table frame attribute is overriden by CSS in most browsers. */ | 
|  | 439 | div.tableblock > table[frame="void"] { | 
|  | 440 | border-style: none; | 
|  | 441 | } | 
|  | 442 | div.tableblock > table[frame="hsides"] { | 
|  | 443 | border-left-style: none; | 
|  | 444 | border-right-style: none; | 
|  | 445 | } | 
|  | 446 | div.tableblock > table[frame="vsides"] { | 
|  | 447 | border-top-style: none; | 
|  | 448 | border-bottom-style: none; | 
|  | 449 | } | 
|  | 450 |  | 
|  | 451 |  | 
|  | 452 | /* | 
|  | 453 | * html5 specific | 
|  | 454 | * | 
|  | 455 | * */ | 
|  | 456 |  | 
|  | 457 | table.tableblock { | 
|  | 458 | margin-top: 1.0em; | 
|  | 459 | margin-bottom: 1.5em; | 
|  | 460 | } | 
|  | 461 | thead, p.tableblock.header { | 
|  | 462 | font-weight: bold; | 
|  | 463 | color: #527bbd; | 
|  | 464 | } | 
|  | 465 | p.tableblock { | 
|  | 466 | margin-top: 0; | 
|  | 467 | } | 
|  | 468 | table.tableblock { | 
|  | 469 | border-width: 3px; | 
|  | 470 | border-spacing: 0px; | 
|  | 471 | border-style: solid; | 
|  | 472 | border-color: #527bbd; | 
|  | 473 | border-collapse: collapse; | 
|  | 474 | } | 
|  | 475 | th.tableblock, td.tableblock { | 
|  | 476 | border-width: 1px; | 
|  | 477 | padding: 4px; | 
|  | 478 | border-style: solid; | 
|  | 479 | border-color: #527bbd; | 
|  | 480 | } | 
|  | 481 |  | 
|  | 482 | table.tableblock.frame-topbot { | 
|  | 483 | border-left-style: hidden; | 
|  | 484 | border-right-style: hidden; | 
|  | 485 | } | 
|  | 486 | table.tableblock.frame-sides { | 
|  | 487 | border-top-style: hidden; | 
|  | 488 | border-bottom-style: hidden; | 
|  | 489 | } | 
|  | 490 | table.tableblock.frame-none { | 
|  | 491 | border-style: hidden; | 
|  | 492 | } | 
|  | 493 |  | 
|  | 494 | th.tableblock.halign-left, td.tableblock.halign-left { | 
|  | 495 | text-align: left; | 
|  | 496 | } | 
|  | 497 | th.tableblock.halign-center, td.tableblock.halign-center { | 
|  | 498 | text-align: center; | 
|  | 499 | } | 
|  | 500 | th.tableblock.halign-right, td.tableblock.halign-right { | 
|  | 501 | text-align: right; | 
|  | 502 | } | 
|  | 503 |  | 
|  | 504 | th.tableblock.valign-top, td.tableblock.valign-top { | 
|  | 505 | vertical-align: top; | 
|  | 506 | } | 
|  | 507 | th.tableblock.valign-middle, td.tableblock.valign-middle { | 
|  | 508 | vertical-align: middle; | 
|  | 509 | } | 
|  | 510 | th.tableblock.valign-bottom, td.tableblock.valign-bottom { | 
|  | 511 | vertical-align: bottom; | 
|  | 512 | } | 
|  | 513 |  | 
|  | 514 |  | 
|  | 515 | /* | 
|  | 516 | * manpage specific | 
|  | 517 | * | 
|  | 518 | * */ | 
|  | 519 |  | 
|  | 520 | body.manpage h1 { | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 521 | padding-top: 0.5em; | 
|  | 522 | padding-bottom: 0.5em; | 
|  | 523 | border-top: 2px solid silver; | 
|  | 524 | border-bottom: 2px solid silver; | 
|  | 525 | } | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 526 | body.manpage h2 { | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 527 | border-style: none; | 
|  | 528 | } | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 529 | body.manpage div.sectionbody { | 
|  | 530 | margin-left: 3em; | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 531 | } | 
|  | 532 |  | 
|  | 533 | @media print { | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 534 | body.manpage div#toc { display: none; } | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 535 | } | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 536 |  | 
|  | 537 |  | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 538 | </style> | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 539 | <script type="text/javascript"> | 
|  | 540 | /*<![CDATA[*/ | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 541 | var asciidoc = { // Namespace. | 
|  | 542 |  | 
|  | 543 | ///////////////////////////////////////////////////////////////////// | 
|  | 544 | // Table Of Contents generator | 
|  | 545 | ///////////////////////////////////////////////////////////////////// | 
|  | 546 |  | 
|  | 547 | /* Author: Mihai Bazon, September 2002 | 
|  | 548 | * http://students.infoiasi.ro/~mishoo | 
|  | 549 | * | 
|  | 550 | * Table Of Content generator | 
|  | 551 | * Version: 0.4 | 
|  | 552 | * | 
|  | 553 | * Feel free to use this script under the terms of the GNU General Public | 
|  | 554 | * License, as long as you do not remove or alter this notice. | 
|  | 555 | */ | 
|  | 556 |  | 
|  | 557 | /* modified by Troy D. Hanson, September 2006. License: GPL */ | 
|  | 558 | /* modified by Stuart Rackham, 2006, 2009. License: GPL */ | 
|  | 559 |  | 
|  | 560 | // toclevels = 1..4. | 
|  | 561 | toc: function (toclevels) { | 
|  | 562 |  | 
|  | 563 | function getText(el) { | 
|  | 564 | var text = ""; | 
|  | 565 | for (var i = el.firstChild; i != null; i = i.nextSibling) { | 
|  | 566 | if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants. | 
|  | 567 | text += i.data; | 
|  | 568 | else if (i.firstChild != null) | 
|  | 569 | text += getText(i); | 
|  | 570 | } | 
|  | 571 | return text; | 
|  | 572 | } | 
|  | 573 |  | 
|  | 574 | function TocEntry(el, text, toclevel) { | 
|  | 575 | this.element = el; | 
|  | 576 | this.text = text; | 
|  | 577 | this.toclevel = toclevel; | 
|  | 578 | } | 
|  | 579 |  | 
|  | 580 | function tocEntries(el, toclevels) { | 
|  | 581 | var result = new Array; | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 582 | var re = new RegExp('[hH]([1-'+(toclevels+1)+'])'); | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 583 | // Function that scans the DOM tree for header elements (the DOM2 | 
|  | 584 | // nodeIterator API would be a better technique but not supported by all | 
|  | 585 | // browsers). | 
|  | 586 | var iterate = function (el) { | 
|  | 587 | for (var i = el.firstChild; i != null; i = i.nextSibling) { | 
|  | 588 | if (i.nodeType == 1 /* Node.ELEMENT_NODE */) { | 
|  | 589 | var mo = re.exec(i.tagName); | 
|  | 590 | if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") { | 
|  | 591 | result[result.length] = new TocEntry(i, getText(i), mo[1]-1); | 
|  | 592 | } | 
|  | 593 | iterate(i); | 
|  | 594 | } | 
|  | 595 | } | 
|  | 596 | } | 
|  | 597 | iterate(el); | 
|  | 598 | return result; | 
|  | 599 | } | 
|  | 600 |  | 
|  | 601 | var toc = document.getElementById("toc"); | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 602 | if (!toc) { | 
|  | 603 | return; | 
|  | 604 | } | 
|  | 605 |  | 
|  | 606 | // Delete existing TOC entries in case we're reloading the TOC. | 
|  | 607 | var tocEntriesToRemove = []; | 
|  | 608 | var i; | 
|  | 609 | for (i = 0; i < toc.childNodes.length; i++) { | 
|  | 610 | var entry = toc.childNodes[i]; | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 611 | if (entry.nodeName.toLowerCase() == 'div' | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 612 | && entry.getAttribute("class") | 
|  | 613 | && entry.getAttribute("class").match(/^toclevel/)) | 
|  | 614 | tocEntriesToRemove.push(entry); | 
|  | 615 | } | 
|  | 616 | for (i = 0; i < tocEntriesToRemove.length; i++) { | 
|  | 617 | toc.removeChild(tocEntriesToRemove[i]); | 
|  | 618 | } | 
|  | 619 |  | 
|  | 620 | // Rebuild TOC entries. | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 621 | var entries = tocEntries(document.getElementById("content"), toclevels); | 
|  | 622 | for (var i = 0; i < entries.length; ++i) { | 
|  | 623 | var entry = entries[i]; | 
|  | 624 | if (entry.element.id == "") | 
|  | 625 | entry.element.id = "_toc_" + i; | 
|  | 626 | var a = document.createElement("a"); | 
|  | 627 | a.href = "#" + entry.element.id; | 
|  | 628 | a.appendChild(document.createTextNode(entry.text)); | 
|  | 629 | var div = document.createElement("div"); | 
|  | 630 | div.appendChild(a); | 
|  | 631 | div.className = "toclevel" + entry.toclevel; | 
|  | 632 | toc.appendChild(div); | 
|  | 633 | } | 
|  | 634 | if (entries.length == 0) | 
|  | 635 | toc.parentNode.removeChild(toc); | 
|  | 636 | }, | 
|  | 637 |  | 
|  | 638 |  | 
|  | 639 | ///////////////////////////////////////////////////////////////////// | 
|  | 640 | // Footnotes generator | 
|  | 641 | ///////////////////////////////////////////////////////////////////// | 
|  | 642 |  | 
|  | 643 | /* Based on footnote generation code from: | 
|  | 644 | * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html | 
|  | 645 | */ | 
|  | 646 |  | 
|  | 647 | footnotes: function () { | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 648 | // Delete existing footnote entries in case we're reloading the footnodes. | 
|  | 649 | var i; | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 650 | var noteholder = document.getElementById("footnotes"); | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 651 | if (!noteholder) { | 
|  | 652 | return; | 
|  | 653 | } | 
|  | 654 | var entriesToRemove = []; | 
|  | 655 | for (i = 0; i < noteholder.childNodes.length; i++) { | 
|  | 656 | var entry = noteholder.childNodes[i]; | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 657 | if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote") | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 658 | entriesToRemove.push(entry); | 
|  | 659 | } | 
|  | 660 | for (i = 0; i < entriesToRemove.length; i++) { | 
|  | 661 | noteholder.removeChild(entriesToRemove[i]); | 
|  | 662 | } | 
|  | 663 |  | 
|  | 664 | // Rebuild footnote entries. | 
|  | 665 | var cont = document.getElementById("content"); | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 666 | var spans = cont.getElementsByTagName("span"); | 
|  | 667 | var refs = {}; | 
|  | 668 | var n = 0; | 
|  | 669 | for (i=0; i<spans.length; i++) { | 
|  | 670 | if (spans[i].className == "footnote") { | 
|  | 671 | n++; | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 672 | var note = spans[i].getAttribute("data-note"); | 
|  | 673 | if (!note) { | 
|  | 674 | // Use [\s\S] in place of . so multi-line matches work. | 
|  | 675 | // Because JavaScript has no s (dotall) regex flag. | 
|  | 676 | note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1]; | 
|  | 677 | spans[i].innerHTML = | 
|  | 678 | "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n + | 
|  | 679 | "' title='View footnote' class='footnote'>" + n + "</a>]"; | 
|  | 680 | spans[i].setAttribute("data-note", note); | 
|  | 681 | } | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 682 | noteholder.innerHTML += | 
|  | 683 | "<div class='footnote' id='_footnote_" + n + "'>" + | 
|  | 684 | "<a href='#_footnoteref_" + n + "' title='Return to text'>" + | 
|  | 685 | n + "</a>. " + note + "</div>"; | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 686 | var id =spans[i].getAttribute("id"); | 
|  | 687 | if (id != null) refs["#"+id] = n; | 
|  | 688 | } | 
|  | 689 | } | 
|  | 690 | if (n == 0) | 
|  | 691 | noteholder.parentNode.removeChild(noteholder); | 
|  | 692 | else { | 
|  | 693 | // Process footnoterefs. | 
|  | 694 | for (i=0; i<spans.length; i++) { | 
|  | 695 | if (spans[i].className == "footnoteref") { | 
|  | 696 | var href = spans[i].getElementsByTagName("a")[0].getAttribute("href"); | 
|  | 697 | href = href.match(/#.*/)[0]; // Because IE return full URL. | 
|  | 698 | n = refs[href]; | 
|  | 699 | spans[i].innerHTML = | 
|  | 700 | "[<a href='#_footnote_" + n + | 
|  | 701 | "' title='View footnote' class='footnote'>" + n + "</a>]"; | 
|  | 702 | } | 
|  | 703 | } | 
|  | 704 | } | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 705 | }, | 
|  | 706 |  | 
|  | 707 | install: function(toclevels) { | 
|  | 708 | var timerId; | 
|  | 709 |  | 
|  | 710 | function reinstall() { | 
|  | 711 | asciidoc.footnotes(); | 
|  | 712 | if (toclevels) { | 
|  | 713 | asciidoc.toc(toclevels); | 
|  | 714 | } | 
|  | 715 | } | 
|  | 716 |  | 
|  | 717 | function reinstallAndRemoveTimer() { | 
|  | 718 | clearInterval(timerId); | 
|  | 719 | reinstall(); | 
|  | 720 | } | 
|  | 721 |  | 
|  | 722 | timerId = setInterval(reinstall, 500); | 
|  | 723 | if (document.addEventListener) | 
|  | 724 | document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false); | 
|  | 725 | else | 
|  | 726 | window.onload = reinstallAndRemoveTimer; | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 727 | } | 
|  | 728 |  | 
|  | 729 | } | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 730 | asciidoc.install(); | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 731 | /*]]>*/ | 
|  | 732 | </script> | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 733 | </head> | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 734 | <body class="manpage"> | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 735 | <div id="header"> | 
|  | 736 | <h1> | 
|  | 737 | git-reset(1) Manual Page | 
|  | 738 | </h1> | 
|  | 739 | <h2>NAME</h2> | 
|  | 740 | <div class="sectionbody"> | 
|  | 741 | <p>git-reset - | 
| Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 742 | Reset current HEAD to the specified state | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 743 | </p> | 
|  | 744 | </div> | 
|  | 745 | </div> | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 746 | <div id="content"> | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 747 | <div class="sect1"> | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 748 | <h2 id="_synopsis">SYNOPSIS</h2> | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 749 | <div class="sectionbody"> | 
| Junio C Hamano | d793de5 | 2006-12-26 09:11:43 | [diff] [blame] | 750 | <div class="verseblock"> | 
| Junio C Hamano | e77c5d0 | 2013-01-22 19:19:59 | [diff] [blame] | 751 | <pre class="content"><em>git reset</em> [-q] [<tree-ish>] [--] <paths>… | 
| Junio C Hamano | 4e1d0cb | 2013-07-19 20:43:00 | [diff] [blame] | 752 | <em>git reset</em> (--patch | -p) [<tree-ish>] [--] [<paths>…] | 
| Junio C Hamano | 5b3533d | 2014-02-27 23:07:15 | [diff] [blame] | 753 | <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] | 754 | <div class="attribution"> | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 755 | </div></div> | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 756 | </div> | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 757 | </div> | 
|  | 758 | <div class="sect1"> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 759 | <h2 id="_description">DESCRIPTION</h2> | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 760 | <div class="sectionbody"> | 
| Junio C Hamano | e77c5d0 | 2013-01-22 19:19:59 | [diff] [blame] | 761 | <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] | 762 | 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] | 763 | modifying index and working tree to match. The <tree-ish>/<commit> defaults | 
|  | 764 | to HEAD in all forms.</p></div> | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 765 | <div class="dlist"><dl> | 
|  | 766 | <dt class="hdlist1"> | 
| Junio C Hamano | e77c5d0 | 2013-01-22 19:19:59 | [diff] [blame] | 767 | <em>git reset</em> [-q] [<tree-ish>] [--] <paths>… | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 768 | </dt> | 
|  | 769 | <dd> | 
|  | 770 | <p> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 771 | This form resets the index entries for all <paths> to their | 
| Junio C Hamano | d75148a | 2014-04-08 19:48:38 | [diff] [blame] | 772 | state at <tree-ish>. (It does not affect the working tree or | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 773 | the current branch.) | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 774 | </p> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 775 | <div class="paragraph"><p>This means that <code>git reset <paths></code> is the opposite of <code>git add | 
|  | 776 | <paths></code>.</p></div> | 
|  | 777 | <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] | 778 | 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] | 779 | the working tree. | 
| Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 780 | 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] | 781 | can copy the contents of a path out of a commit to the index and to the | 
|  | 782 | working tree in one go.</p></div> | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 783 | </dd> | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 784 | <dt class="hdlist1"> | 
| Junio C Hamano | e77c5d0 | 2013-01-22 19:19:59 | [diff] [blame] | 785 | <em>git reset</em> (--patch | -p) [<tree-ish>] [--] [<paths>…] | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 786 | </dt> | 
|  | 787 | <dd> | 
|  | 788 | <p> | 
|  | 789 | Interactively select hunks in the difference between the index | 
| Junio C Hamano | e77c5d0 | 2013-01-22 19:19:59 | [diff] [blame] | 790 | and <tree-ish> (defaults to HEAD). The chosen hunks are applied | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 791 | in reverse to the index. | 
|  | 792 | </p> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 793 | <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] | 794 | you can use it to selectively reset hunks. See the “Interactive Mode” | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 795 | 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] | 796 | </dd> | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 797 | <dt class="hdlist1"> | 
| Junio C Hamano | a129545 | 2012-11-13 22:32:04 | [diff] [blame] | 798 | <em>git reset</em> [<mode>] [<commit>] | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 799 | </dt> | 
|  | 800 | <dd> | 
|  | 801 | <p> | 
| Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 802 | This form resets the current branch head to <commit> and | 
|  | 803 | possibly updates the index (resetting it to the tree of <commit>) and | 
| Junio C Hamano | a129545 | 2012-11-13 22:32:04 | [diff] [blame] | 804 | the working tree depending on <mode>. If <mode> is omitted, | 
|  | 805 | defaults to "--mixed". The <mode> must be one of the following: | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 806 | </p> | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 807 | <div class="openblock"> | 
|  | 808 | <div class="content"> | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 809 | <div class="dlist"><dl> | 
|  | 810 | <dt class="hdlist1"> | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 811 | --soft | 
|  | 812 | </dt> | 
|  | 813 | <dd> | 
|  | 814 | <p> | 
| Junio C Hamano | d75148a | 2014-04-08 19:48:38 | [diff] [blame] | 815 | Does not touch the index file or the working tree at all (but | 
| Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 816 | resets the head to <commit>, just like all modes do). This leaves | 
|  | 817 | all your changed files "Changes to be committed", as <em>git status</em> | 
|  | 818 | would put it. | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 819 | </p> | 
|  | 820 | </dd> | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 821 | <dt class="hdlist1"> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 822 | --mixed | 
|  | 823 | </dt> | 
|  | 824 | <dd> | 
|  | 825 | <p> | 
|  | 826 | Resets the index but not the working tree (i.e., the changed files | 
|  | 827 | are preserved but not marked for commit) and reports what has not | 
|  | 828 | been updated. This is the default action. | 
|  | 829 | </p> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 830 | <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] | 831 | <a href="git-add.html">git-add(1)</a>).</p></div> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 904 | <pre><code>$ 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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 908 | $ git pull git://info.example.com/ nitfol <b><4></b></code></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 | 535c65c | 2017-06-24 22:51:58 | [diff] [blame] | 921 | Somebody asks you to pull, and the changes sound 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 | 
| Junio C Hamano | d75148a | 2014-04-08 19:48:38 | [diff] [blame] | 928 | to make does not affect frotz.c or filfre.c, so you revert the | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 947 | <pre><code>$ 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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 950 | $ git commit -a -c ORIG_HEAD <b><3></b></code></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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 981 | <pre><code>$ 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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 983 | $ git checkout topic/wip <b><3></b></code></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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1012 | <pre><code>$ git commit ... | 
|  | 1013 | $ git reset --hard HEAD~3 <b><1></b></code></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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1033 | <pre><code>$ 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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1041 | $ git reset --hard ORIG_HEAD <b><4></b></code></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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1081 | <pre><code>$ 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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1086 | $ git reset --merge ORIG_HEAD <b><2></b></code></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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1118 | <pre><code>$ 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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1126 | $ git reset <b><3></b></code></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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1159 | <pre><code>$ 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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1161 | $ git add frotz.c <b><3></b></code></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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1193 | <pre><code>$ 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 | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1199 | $ git reset --keep start <b><3></b></code></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 | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1223 | <dt class="hdlist1"> | 
| Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1224 | Split a commit apart into a sequence of commits | 
| Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1225 | </dt> | 
|  | 1226 | <dd> | 
| Junio C Hamano | 967cda7 | 2017-06-30 21:49:53 | [diff] [blame] | 1227 | <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] | 1228 | them together. Then, later you decide that it might be better to have each | 
|  | 1229 | logical chunk associated with its own commit. You can use git reset to rewind | 
|  | 1230 | history without changing the contents of your local files, and then successively | 
|  | 1231 | use <code>git add -p</code> to interactively select which hunks to include into each commit, | 
|  | 1232 | 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] | 1233 | <div class="listingblock"> | 
|  | 1234 | <div class="content"> | 
| Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1235 | <pre><code>$ git reset -N HEAD^ <b><1></b> | 
| Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1236 | $ git add -p <b><2></b> | 
|  | 1237 | $ git diff --cached <b><3></b> | 
|  | 1238 | $ git commit -c HEAD@{1} <b><4></b> | 
| Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1239 | ... <b><5></b> | 
|  | 1240 | $ git add ... <b><6></b> | 
|  | 1241 | $ git diff --cached <b><7></b> | 
|  | 1242 | $ git commit ... <b><8></b></code></pre> | 
| Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1243 | </div></div> | 
|  | 1244 | <div class="colist arabic"><ol> | 
|  | 1245 | <li> | 
|  | 1246 | <p> | 
|  | 1247 | 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] | 1248 | commit, but leave the working tree with all the changes. The -N ensures | 
|  | 1249 | that any new files added with HEAD are still marked so that git add -p | 
|  | 1250 | will find them. | 
| Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1251 | </p> | 
|  | 1252 | </li> | 
|  | 1253 | <li> | 
|  | 1254 | <p> | 
| Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1255 | Next, we interactively select diff hunks to add using the git add -p | 
|  | 1256 | facility. This will ask you about each diff hunk in sequence and you can | 
|  | 1257 | use simple commands such as "yes, include this", "No don’t include this" | 
|  | 1258 | or even the very powerful "edit" facility. | 
| Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1259 | </p> | 
|  | 1260 | </li> | 
|  | 1261 | <li> | 
|  | 1262 | <p> | 
| Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1263 | Once satisfied with the hunks you want to include, you should verify what | 
|  | 1264 | has been prepared for the first commit by using git diff --cached. This | 
|  | 1265 | shows all the changes that have been moved into the index and are about | 
|  | 1266 | to be committed. | 
| Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1267 | </p> | 
|  | 1268 | </li> | 
|  | 1269 | <li> | 
|  | 1270 | <p> | 
| Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1271 | Next, commit the changes stored in the index. The -c option specifies to | 
|  | 1272 | pre-populate the commit message from the original message that you started | 
|  | 1273 | is a special notation for the commit that HEAD used to be at prior to the | 
|  | 1274 | original reset commit (1 change ago). See <a href="git-reflog.html">git-reflog(1)</a> for more | 
|  | 1275 | details. You may also use any other valid commit reference. | 
| Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1276 | </p> | 
|  | 1277 | </li> | 
|  | 1278 | <li> | 
|  | 1279 | <p> | 
| Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1280 | You can repeat steps 2-4 multiple times to break the original code into | 
|  | 1281 | any number of commits. | 
| Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1282 | </p> | 
|  | 1283 | </li> | 
|  | 1284 | <li> | 
|  | 1285 | <p> | 
| Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1286 | Now you’ve split out many of the changes into their own commits, and might | 
|  | 1287 | no longer use the patch mode of git add, in order to select all remaining | 
|  | 1288 | uncommitted changes. | 
| Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1289 | </p> | 
|  | 1290 | </li> | 
|  | 1291 | <li> | 
|  | 1292 | <p> | 
| Junio C Hamano | ce01de8 | 2017-02-16 22:59:12 | [diff] [blame] | 1293 | Once again, check to verify that you’ve included what you want to. You may | 
|  | 1294 | also wish to verify that git diff doesn’t show any remaining changes to be | 
|  | 1295 | committed later. | 
|  | 1296 | </p> | 
|  | 1297 | </li> | 
|  | 1298 | <li> | 
|  | 1299 | <p> | 
|  | 1300 | And finally create the final commit. | 
| Junio C Hamano | e89102f | 2017-02-15 23:18:15 | [diff] [blame] | 1301 | </p> | 
|  | 1302 | </li> | 
|  | 1303 | </ol></div> | 
|  | 1304 | </dd> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1305 | </dl></div> | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1306 | </div> | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1307 | </div> | 
|  | 1308 | <div class="sect1"> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1309 | <h2 id="_discussion">DISCUSSION</h2> | 
|  | 1310 | <div class="sectionbody"> | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1311 | <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] | 1312 | <div class="listingblock"> | 
|  | 1313 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1314 | <pre><code>git reset --option target</code></pre> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1315 | </div></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1316 | <div class="paragraph"><p>to reset the HEAD to another commit (<code>target</code>) with the different | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1317 | reset options depending on the state of the files.</p></div> | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1318 | <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] | 1319 | file. For example, the first line of the first table means that if a | 
|  | 1320 | file is in state A in the working tree, in state B in the index, in | 
|  | 1321 | 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] | 1322 | target" will leave the file in the working tree in state A and in the | 
|  | 1323 | index in state B. It resets (i.e. moves) the HEAD (i.e. the tip of | 
|  | 1324 | the current branch, if you are on one) to "target" (which has the file | 
|  | 1325 | in state D).</p></div> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1326 | <div class="literalblock"> | 
|  | 1327 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1328 | <pre><code>working index HEAD target working index HEAD | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1329 | ---------------------------------------------------- | 
|  | 1330 | A B C D --soft A B D | 
|  | 1331 | --mixed A D D | 
|  | 1332 | --hard D D D | 
|  | 1333 | --merge (disallowed) | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1334 | --keep (disallowed)</code></pre> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1335 | </div></div> | 
|  | 1336 | <div class="literalblock"> | 
|  | 1337 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1338 | <pre><code>working index HEAD target working index HEAD | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1339 | ---------------------------------------------------- | 
|  | 1340 | A B C C --soft A B C | 
|  | 1341 | --mixed A C C | 
|  | 1342 | --hard C C C | 
|  | 1343 | --merge (disallowed) | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1344 | --keep A C C</code></pre> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1345 | </div></div> | 
|  | 1346 | <div class="literalblock"> | 
|  | 1347 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1348 | <pre><code>working index HEAD target working index HEAD | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1349 | ---------------------------------------------------- | 
|  | 1350 | B B C D --soft B B D | 
|  | 1351 | --mixed B D D | 
|  | 1352 | --hard D D D | 
|  | 1353 | --merge D D D | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1354 | --keep (disallowed)</code></pre> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1355 | </div></div> | 
|  | 1356 | <div class="literalblock"> | 
|  | 1357 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1358 | <pre><code>working index HEAD target working index HEAD | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1359 | ---------------------------------------------------- | 
|  | 1360 | B B C C --soft B B C | 
|  | 1361 | --mixed B C C | 
|  | 1362 | --hard C C C | 
|  | 1363 | --merge C C C | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1364 | --keep B C C</code></pre> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1365 | </div></div> | 
|  | 1366 | <div class="literalblock"> | 
|  | 1367 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1368 | <pre><code>working index HEAD target working index HEAD | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1369 | ---------------------------------------------------- | 
|  | 1370 | B C C D --soft B C D | 
|  | 1371 | --mixed B D D | 
|  | 1372 | --hard D D D | 
|  | 1373 | --merge (disallowed) | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1374 | --keep (disallowed)</code></pre> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1375 | </div></div> | 
|  | 1376 | <div class="literalblock"> | 
|  | 1377 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1378 | <pre><code>working index HEAD target working index HEAD | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1379 | ---------------------------------------------------- | 
|  | 1380 | B C C C --soft B C C | 
|  | 1381 | --mixed B C C | 
|  | 1382 | --hard C C C | 
|  | 1383 | --merge B C C | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1384 | --keep B C C</code></pre> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1385 | </div></div> | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1386 | <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] | 1387 | merge. Any mergy operation guarantees that the working tree file that is | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1388 | 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] | 1389 | 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] | 1390 | we see some difference between the index and the target and also | 
| Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 1391 | 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] | 1392 | resetting out from a state that a mergy operation left after failing | 
|  | 1393 | 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] | 1394 | <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] | 1395 | commits in the current branch while keeping changes in the working | 
|  | 1396 | tree. If there could be conflicts between the changes in the commit we | 
|  | 1397 | 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] | 1398 | 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] | 1399 | changes between the working tree and HEAD, and between HEAD and the | 
|  | 1400 | target. To be safe, it is also disallowed when there are unmerged | 
|  | 1401 | entries.</p></div> | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1402 | <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] | 1403 | entries:</p></div> | 
|  | 1404 | <div class="literalblock"> | 
|  | 1405 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1406 | <pre><code>working index HEAD target working index HEAD | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1407 | ---------------------------------------------------- | 
|  | 1408 | X U A B --soft (disallowed) | 
|  | 1409 | --mixed X B B | 
|  | 1410 | --hard B B B | 
|  | 1411 | --merge B B B | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1412 | --keep (disallowed)</code></pre> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1413 | </div></div> | 
|  | 1414 | <div class="literalblock"> | 
|  | 1415 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1416 | <pre><code>working index HEAD target working index HEAD | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1417 | ---------------------------------------------------- | 
|  | 1418 | X U A A --soft (disallowed) | 
|  | 1419 | --mixed X A A | 
|  | 1420 | --hard A A A | 
|  | 1421 | --merge A A A | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1422 | --keep (disallowed)</code></pre> | 
| Junio C Hamano | b5a296f | 2010-08-13 02:46:36 | [diff] [blame] | 1423 | </div></div> | 
| Junio C Hamano | 68cf15a | 2010-11-06 01:01:59 | [diff] [blame] | 1424 | <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] | 1425 | </div> | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1426 | </div> | 
|  | 1427 | <div class="sect1"> | 
| Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1428 | <h2 id="_git">GIT</h2> | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1429 | <div class="sectionbody"> | 
| Junio C Hamano | a28a920 | 2012-06-21 07:08:23 | [diff] [blame] | 1430 | <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] | 1431 | </div> | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 1432 | </div> | 
| Junio C Hamano | 9d97115 | 2012-12-19 00:43:11 | [diff] [blame] | 1433 | </div> | 
| Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 1434 | <div id="footnotes"><hr /></div> | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1435 | <div id="footer"> | 
|  | 1436 | <div id="footer-text"> | 
| Junio C Hamano | 2ef0ba3 | 2018-01-26 23:13:53 | [diff] [blame] | 1437 | Last updated | 
|  | 1438 | 2018-01-26 15:11:04 PST | 
| Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1439 | </div> | 
|  | 1440 | </div> | 
|  | 1441 | </body> | 
|  | 1442 | </html> |