blob: 0dfcc35306fbab5e03c0592cec80ddab3a7bd900 [file] [log] [blame]
Junio C Hamano944ce252018-05-30 22:25:261<?xml version="1.0" encoding="UTF-8"?>
Junio C Hamano1a4e8412005-12-27 08:17:232<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5<head>
Junio C Hamano9d971152012-12-19 00:43:116<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
Junio C Hamanoa85030a2022-07-27 16:48:217<meta name="generator" content="AsciiDoc 10.2.0" />
Junio C Hamano68cf15a2010-11-06 01:01:598<title>git-reset(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:239<style type="text/css">
Junio C Hamano9d971152012-12-19 00:43:1110/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
11
12/* Default font. */
13body {
14 font-family: Georgia,serif;
15}
16
17/* Title font. */
18h1, h2, h3, h4, h5, h6,
19div.title, caption.title,
20thead, p.table.header,
21#toctitle,
22#author, #revnumber, #revdate, #revremark,
23#footer {
24 font-family: Arial,Helvetica,sans-serif;
Junio C Hamano1a4e8412005-12-27 08:17:2325}
26
27body {
28 margin: 1em 5% 1em 5%;
29}
30
Junio C Hamanoba4b9282008-07-06 05:20:3131a {
32 color: blue;
33 text-decoration: underline;
34}
35a:visited {
36 color: fuchsia;
37}
Junio C Hamano1a4e8412005-12-27 08:17:2338
39em {
40 font-style: italic;
Junio C Hamano68cf15a2010-11-06 01:01:5941 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2342}
43
44strong {
45 font-weight: bold;
Junio C Hamano68cf15a2010-11-06 01:01:5946 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2347}
48
Junio C Hamano1a4e8412005-12-27 08:17:2349h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:2351 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
54}
55
Junio C Hamanoba4b9282008-07-06 05:20:3156h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2357 border-bottom: 2px solid silver;
58}
59h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2360 padding-top: 0.5em;
61}
Junio C Hamanoba4b9282008-07-06 05:20:3162h3 {
63 float: left;
64}
65h3 + * {
66 clear: left;
67}
Junio C Hamano9d971152012-12-19 00:43:1168h5 {
69 font-size: 1.0em;
70}
Junio C Hamano1a4e8412005-12-27 08:17:2371
72div.sectionbody {
Junio C Hamano1a4e8412005-12-27 08:17:2373 margin-left: 0;
74}
75
76hr {
77 border: 1px solid silver;
78}
79
80p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
83}
84
Junio C Hamano68cf15a2010-11-06 01:01:5985ul, ol, li > p {
86 margin-top: 0;
87}
Junio C Hamano9d971152012-12-19 00:43:1188ul > li { color: #aaa; }
89ul > li > * { color: black; }
Junio C Hamano68cf15a2010-11-06 01:01:5990
Junio C Hamanoc14e6ad2014-10-31 20:25:5391.monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2395 padding: 0;
96 margin: 0;
97}
Junio C Hamanoc14e6ad2014-10-31 20:25:5398pre {
99 white-space: pre-wrap;
100}
Junio C Hamano1a4e8412005-12-27 08:17:23101
Junio C Hamano9d971152012-12-19 00:43:11102#author {
Junio C Hamano1a4e8412005-12-27 08:17:23103 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23104 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:31105 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23106}
Junio C Hamano9d971152012-12-19 00:43:11107#email {
Junio C Hamano1a4e8412005-12-27 08:17:23108}
Junio C Hamano9d971152012-12-19 00:43:11109#revnumber, #revdate, #revremark {
Junio C Hamano1a4e8412005-12-27 08:17:23110}
111
Junio C Hamano9d971152012-12-19 00:43:11112#footer {
Junio C Hamano1a4e8412005-12-27 08:17:23113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
117}
Junio C Hamano9d971152012-12-19 00:43:11118#footer-text {
Junio C Hamano1a4e8412005-12-27 08:17:23119 float: left;
120 padding-bottom: 0.5em;
121}
Junio C Hamano9d971152012-12-19 00:43:11122#footer-badges {
Junio C Hamano1a4e8412005-12-27 08:17:23123 float: right;
124 padding-bottom: 0.5em;
125}
126
Junio C Hamano9d971152012-12-19 00:43:11127#preamble {
Junio C Hamano68cf15a2010-11-06 01:01:59128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
130}
Junio C Hamano9d971152012-12-19 00:43:11131div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamano1a4e8412005-12-27 08:17:23132div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22134 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23135 margin-bottom: 1.5em;
136}
137div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23142}
143
144div.content { /* Block element content. */
145 padding: 0;
146}
147
148/* Block element titles. */
149div.title, caption.title {
Junio C Hamano68cf15a2010-11-06 01:01:59150 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
155}
156div.title + * {
157 margin-top: 0;
158}
159
160td div.title:first-child {
161 margin-top: 0.0em;
162}
163div.content div.title:first-child {
164 margin-top: 0.0em;
165}
166div.content + div.title {
167 margin-top: 0.0em;
168}
169
170div.sidebarblock > div.content {
171 background: #ffffee;
Junio C Hamano9d971152012-12-19 00:43:11172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
Junio C Hamano1a4e8412005-12-27 08:17:23174 padding: 0.5em;
175}
176
177div.listingblock > div.content {
Junio C Hamano9d971152012-12-19 00:43:11178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
Junio C Hamano1a4e8412005-12-27 08:17:23181 padding: 0.5em;
182}
183
Junio C Hamano7bd050f2011-09-22 06:32:22184div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
Junio C Hamano68cf15a2010-11-06 01:01:59187 margin-right: 10%;
Junio C Hamano9d971152012-12-19 00:43:11188 border-left: 5px solid #f0f0f0;
189 color: #888;
Junio C Hamano1a4e8412005-12-27 08:17:23190}
Junio C Hamano7bd050f2011-09-22 06:32:22191
Junio C Hamano68cf15a2010-11-06 01:01:59192div.quoteblock > div.attribution {
193 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23194 text-align: right;
195}
Junio C Hamano68cf15a2010-11-06 01:01:59196
Junio C Hamano9d971152012-12-19 00:43:11197div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
Junio C Hamano68cf15a2010-11-06 01:01:59200}
201div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
204}
205/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31206div.verseblock + div.attribution {
207 text-align: left;
208}
Junio C Hamano1a4e8412005-12-27 08:17:23209
210div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
217}
218div.admonitionblock td.content {
219 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22220 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23221}
222
223div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23226}
227
Junio C Hamano1a4e8412005-12-27 08:17:23228div.imageblock div.content { padding-left: 0; }
Junio C Hamanoc14e6ad2014-10-31 20:25:53229span.image img { border-style: none; vertical-align: text-bottom; }
Junio C Hamano68cf15a2010-11-06 01:01:59230a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23231
232dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
235}
236dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
Junio C Hamano68cf15a2010-11-06 01:01:59239 font-style: normal;
240 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23241}
242dd > *:first-child {
Junio C Hamano68cf15a2010-11-06 01:01:59243 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23244}
245
246ul, ol {
247 list-style-position: outside;
248}
Junio C Hamano68cf15a2010-11-06 01:01:59249ol.arabic {
250 list-style-type: decimal;
251}
252ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23253 list-style-type: lower-alpha;
254}
Junio C Hamano68cf15a2010-11-06 01:01:59255ol.upperalpha {
256 list-style-type: upper-alpha;
257}
258ol.lowerroman {
259 list-style-type: lower-roman;
260}
261ol.upperroman {
262 list-style-type: upper-roman;
263}
264
265div.compact ul, div.compact ol,
266div.compact p, div.compact p,
267div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
270}
Junio C Hamano1a4e8412005-12-27 08:17:23271
Junio C Hamano1a4e8412005-12-27 08:17:23272tfoot {
273 font-weight: bold;
274}
Junio C Hamano68cf15a2010-11-06 01:01:59275td > div.verse {
276 white-space: pre;
277}
Junio C Hamano68cf15a2010-11-06 01:01:59278
279div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
282}
Junio C Hamano68cf15a2010-11-06 01:01:59283div.hdlist tr {
284 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31285}
Junio C Hamano68cf15a2010-11-06 01:01:59286dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
288}
289td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23290 vertical-align: top;
Junio C Hamano68cf15a2010-11-06 01:01:59291 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23292 padding-right: 0.8em;
Junio C Hamano68cf15a2010-11-06 01:01:59293 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23294}
Junio C Hamano68cf15a2010-11-06 01:01:59295td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23296 vertical-align: top;
297}
Junio C Hamano68cf15a2010-11-06 01:01:59298div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
301}
302
303.comment {
304 background: yellow;
305}
Junio C Hamano1a4e8412005-12-27 08:17:23306
Junio C Hamano7bd050f2011-09-22 06:32:22307.footnote, .footnoteref {
308 font-size: 0.8em;
309}
310
311span.footnote, span.footnoteref {
312 vertical-align: super;
313}
314
315#footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
318}
319
320#footnotes div.footnote {
321 margin: 0 0 5px 0;
322}
323
324#footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
332}
333
Junio C Hamano9d971152012-12-19 00:43:11334div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
338}
339div.colist td img {
340 margin-top: 0.3em;
Junio C Hamano1a4e8412005-12-27 08:17:23341}
Junio C Hamanoba4b9282008-07-06 05:20:31342
Junio C Hamano9d971152012-12-19 00:43:11343@media print {
344 #footer-badges { display: none; }
345}
346
347#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22348 margin-bottom: 2.5em;
349}
350
Junio C Hamano9d971152012-12-19 00:43:11351#toctitle {
Junio C Hamanoba4b9282008-07-06 05:20:31352 color: #527bbd;
Junio C Hamanoba4b9282008-07-06 05:20:31353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
357}
358
Junio C Hamanoc14e6ad2014-10-31 20:25:53359div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamanoba4b9282008-07-06 05:20:31360 margin-top: 0;
361 margin-bottom: 0;
362}
363div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
366}
367div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
370}
371div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
374}
Junio C Hamano9d971152012-12-19 00:43:11375
376span.aqua { color: aqua; }
377span.black { color: black; }
378span.blue { color: blue; }
379span.fuchsia { color: fuchsia; }
380span.gray { color: gray; }
381span.green { color: green; }
382span.lime { color: lime; }
383span.maroon { color: maroon; }
384span.navy { color: navy; }
385span.olive { color: olive; }
386span.purple { color: purple; }
387span.red { color: red; }
388span.silver { color: silver; }
389span.teal { color: teal; }
390span.white { color: white; }
391span.yellow { color: yellow; }
392
393span.aqua-background { background: aqua; }
394span.black-background { background: black; }
395span.blue-background { background: blue; }
396span.fuchsia-background { background: fuchsia; }
397span.gray-background { background: gray; }
398span.green-background { background: green; }
399span.lime-background { background: lime; }
400span.maroon-background { background: maroon; }
401span.navy-background { background: navy; }
402span.olive-background { background: olive; }
403span.purple-background { background: purple; }
404span.red-background { background: red; }
405span.silver-background { background: silver; }
406span.teal-background { background: teal; }
407span.white-background { background: white; }
408span.yellow-background { background: yellow; }
409
410span.big { font-size: 2em; }
411span.small { font-size: 0.6em; }
412
413span.underline { text-decoration: underline; }
414span.overline { text-decoration: overline; }
415span.line-through { text-decoration: line-through; }
416
Junio C Hamanoc14e6ad2014-10-31 20:25:53417div.unbreakable { page-break-inside: avoid; }
418
Junio C Hamano9d971152012-12-19 00:43:11419
420/*
421 * xhtml11 specific
422 *
423 * */
424
425div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
428}
429div.tableblock > table {
430 border: 3px solid #527bbd;
431}
432thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
435}
436p.table {
437 margin-top: 0;
438}
Junio C Hamano725b0da2020-01-22 22:02:40439/* Because the table frame attribute is overridden by CSS in most browsers. */
Junio C Hamano9d971152012-12-19 00:43:11440div.tableblock > table[frame="void"] {
441 border-style: none;
442}
443div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
446}
447div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
450}
451
452
453/*
454 * html5 specific
455 *
456 * */
457
458table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
461}
462thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
465}
466p.tableblock {
467 margin-top: 0;
468}
469table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
475}
476th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
481}
482
483table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
486}
487table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
490}
491table.tableblock.frame-none {
492 border-style: hidden;
493}
494
495th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
497}
498th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
500}
501th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
503}
504
505th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
507}
508th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
510}
511th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
513}
514
515
516/*
517 * manpage specific
518 *
519 * */
520
521body.manpage h1 {
Junio C Hamano68cf15a2010-11-06 01:01:59522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
526}
Junio C Hamano9d971152012-12-19 00:43:11527body.manpage h2 {
Junio C Hamano68cf15a2010-11-06 01:01:59528 border-style: none;
529}
Junio C Hamano9d971152012-12-19 00:43:11530body.manpage div.sectionbody {
531 margin-left: 3em;
Junio C Hamano68cf15a2010-11-06 01:01:59532}
533
534@media print {
Junio C Hamano9d971152012-12-19 00:43:11535 body.manpage div#toc { display: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59536}
Junio C Hamanoc14e6ad2014-10-31 20:25:53537
538
Junio C Hamano1a4e8412005-12-27 08:17:23539</style>
Junio C Hamano7bd050f2011-09-22 06:32:22540<script type="text/javascript">
541/*<![CDATA[*/
Junio C Hamano2b153182021-12-15 21:00:31542var asciidoc = { // Namespace.
543
544/////////////////////////////////////////////////////////////////////
545// Table Of Contents generator
546/////////////////////////////////////////////////////////////////////
547
548/* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
550 *
551 * Table Of Content generator
552 * Version: 0.4
553 *
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
556 */
557
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
560
561// toclevels = 1..4.
562toc: function (toclevels) {
563
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
571 }
572 return text;
573 }
574
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
579 }
580
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
586 // browsers).
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
593 }
594 iterate(i);
595 }
596 }
597 }
598 iterate(el);
599 return result;
600 }
601
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
605 }
606
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
610 for (i = 0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute("class")
614 && entry.getAttribute("class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
616 }
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
619 }
620
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById("content"), toclevels);
623 for (var i = 0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id == "")
626 entry.element.id = "_toc_" + i;
627 var a = document.createElement("a");
628 a.href = "#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement("div");
631 div.appendChild(a);
632 div.className = "toclevel" + entry.toclevel;
633 toc.appendChild(div);
634 }
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
637},
638
639
640/////////////////////////////////////////////////////////////////////
641// Footnotes generator
642/////////////////////////////////////////////////////////////////////
643
644/* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
646 */
647
648footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
650 var i;
651 var noteholder = document.getElementById("footnotes");
652 if (!noteholder) {
653 return;
654 }
655 var entriesToRemove = [];
656 for (i = 0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
659 entriesToRemove.push(entry);
660 }
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
663 }
664
665 // Rebuild footnote entries.
666 var cont = document.getElementById("content");
667 var spans = cont.getElementsByTagName("span");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
673 var note = spans[i].getAttribute("data-note");
674 if (!note) {
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
678 spans[i].innerHTML =
679 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n + "</a>]";
681 spans[i].setAttribute("data-note", note);
682 }
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n + "'>" +
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
686 n + "</a>. " + note + "</div>";
687 var id =spans[i].getAttribute("id");
688 if (id != null) refs["#"+id] = n;
689 }
690 }
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
694 // Process footnoterefs.
695 for (i=0; i<spans.length; i++) {
696 if (spans[i].className == "footnoteref") {
697 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
698 href = href.match(/#.*/)[0]; // Because IE return full URL.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
703 }
704 }
705 }
706},
707
708install: function(toclevels) {
709 var timerId;
710
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
715 }
716 }
717
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
721 }
722
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
728}
729
730}
Junio C Hamano9d971152012-12-19 00:43:11731asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22732/*]]>*/
733</script>
Junio C Hamano1a4e8412005-12-27 08:17:23734</head>
Junio C Hamano9d971152012-12-19 00:43:11735<body class="manpage">
Junio C Hamano1a4e8412005-12-27 08:17:23736<div id="header">
737<h1>
738git-reset(1) Manual Page
739</h1>
740<h2>NAME</h2>
741<div class="sectionbody">
742<p>git-reset -
Junio C Hamano01078922006-03-10 00:31:47743 Reset current HEAD to the specified state
Junio C Hamano1a4e8412005-12-27 08:17:23744</p>
745</div>
746</div>
Junio C Hamano7bd050f2011-09-22 06:32:22747<div id="content">
Junio C Hamano9d971152012-12-19 00:43:11748<div class="sect1">
Junio C Hamano68cf15a2010-11-06 01:01:59749<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23750<div class="sectionbody">
Junio C Hamanod793de52006-12-26 09:11:43751<div class="verseblock">
Junio C Hamanob4896852019-12-10 23:15:09752<pre class="content"><em>git reset</em> [-q] [&lt;tree-ish&gt;] [--] &lt;pathspec&gt;&#8230;
753<em>git reset</em> [-q] [--pathspec-from-file=&lt;file&gt; [--pathspec-file-nul]] [&lt;tree-ish&gt;]
754<em>git reset</em> (--patch | -p) [&lt;tree-ish&gt;] [--] [&lt;pathspec&gt;&#8230;]
Junio C Hamano5b3533d2014-02-27 23:07:15755<em>git reset</em> [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [&lt;commit&gt;]</pre>
Junio C Hamano9d971152012-12-19 00:43:11756<div class="attribution">
Junio C Hamano68cf15a2010-11-06 01:01:59757</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23758</div>
Junio C Hamano9d971152012-12-19 00:43:11759</div>
760<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31761<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23762<div class="sectionbody">
Junio C Hamanob4896852019-12-10 23:15:09763<div class="paragraph"><p>In the first three forms, copy entries from <code>&lt;tree-ish&gt;</code> to the index.
764In the last form, set the current branch head (<code>HEAD</code>) to <code>&lt;commit&gt;</code>,
Junio C Hamanof2b280b2018-12-01 14:45:01765optionally modifying index and working tree to match.
766The <code>&lt;tree-ish&gt;</code>/<code>&lt;commit&gt;</code> defaults to <code>HEAD</code> in all forms.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59767<div class="dlist"><dl>
768<dt class="hdlist1">
Junio C Hamanob4896852019-12-10 23:15:09769<em>git reset</em> [-q] [&lt;tree-ish&gt;] [--] &lt;pathspec&gt;&#8230;
770</dt>
771<dt class="hdlist1">
772<em>git reset</em> [-q] [--pathspec-from-file=&lt;file&gt; [--pathspec-file-nul]] [&lt;tree-ish&gt;]
Junio C Hamano1a4e8412005-12-27 08:17:23773</dt>
774<dd>
775<p>
Junio C Hamanob4896852019-12-10 23:15:09776 These forms reset the index entries for all paths that match the
777 <code>&lt;pathspec&gt;</code> to their state at <code>&lt;tree-ish&gt;</code>. (It does not affect
778 the working tree or the current branch.)
Junio C Hamano1a4e8412005-12-27 08:17:23779</p>
Junio C Hamanob4896852019-12-10 23:15:09780<div class="paragraph"><p>This means that <code>git reset &lt;pathspec&gt;</code> is the opposite of <code>git add
781&lt;pathspec&gt;</code>. This command is equivalent to
782<code>git restore [--source=&lt;tree-ish&gt;] --staged &lt;pathspec&gt;...</code>.</p></div>
783<div class="paragraph"><p>After running <code>git reset &lt;pathspec&gt;</code> to update the index entry, you can
Junio C Hamanoc9f11c22019-07-10 02:54:04784use <a href="git-restore.html">git-restore(1)</a> to check the contents out of the index to
785the working tree. Alternatively, using <a href="git-restore.html">git-restore(1)</a>
786and specifying a commit with <code>--source</code>, you
Junio C Hamano657fd8a2010-10-07 00:01:24787can copy the contents of a path out of a commit to the index and to the
788working tree in one go.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23789</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59790<dt class="hdlist1">
Junio C Hamanob4896852019-12-10 23:15:09791<em>git reset</em> (--patch | -p) [&lt;tree-ish&gt;] [--] [&lt;pathspec&gt;&#8230;]
Junio C Hamanob5a296f2010-08-13 02:46:36792</dt>
793<dd>
794<p>
795 Interactively select hunks in the difference between the index
Junio C Hamanof2b280b2018-12-01 14:45:01796 and <code>&lt;tree-ish&gt;</code> (defaults to <code>HEAD</code>). The chosen hunks are applied
Junio C Hamanob5a296f2010-08-13 02:46:36797 in reverse to the index.
798</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53799<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 Hamano9d971152012-12-19 00:43:11800you can use it to selectively reset hunks. See the &#8220;Interactive Mode&#8221;
Junio C Hamanoc14e6ad2014-10-31 20:25:53801section of <a href="git-add.html">git-add(1)</a> to learn how to operate the <code>--patch</code> mode.</p></div>
Junio C Hamanob5a296f2010-08-13 02:46:36802</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59803<dt class="hdlist1">
Junio C Hamanoa1295452012-11-13 22:32:04804<em>git reset</em> [&lt;mode&gt;] [&lt;commit&gt;]
Junio C Hamanob5a296f2010-08-13 02:46:36805</dt>
806<dd>
807<p>
Junio C Hamanof2b280b2018-12-01 14:45:01808 This form resets the current branch head to <code>&lt;commit&gt;</code> and
809 possibly updates the index (resetting it to the tree of <code>&lt;commit&gt;</code>) and
Junio C Hamanoa75aada2023-01-22 01:54:30810 the working tree depending on <code>&lt;mode&gt;</code>. Before the operation, <code>ORIG_HEAD</code>
811 is set to the tip of the current branch. If <code>&lt;mode&gt;</code> is omitted,
Junio C Hamanof2b280b2018-12-01 14:45:01812 defaults to <code>--mixed</code>. The <code>&lt;mode&gt;</code> must be one of the following:
Junio C Hamanob5a296f2010-08-13 02:46:36813</p>
Junio C Hamano9d971152012-12-19 00:43:11814<div class="openblock">
815<div class="content">
Junio C Hamano68cf15a2010-11-06 01:01:59816<div class="dlist"><dl>
817<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23818--soft
819</dt>
820<dd>
821<p>
Junio C Hamanod75148a2014-04-08 19:48:38822 Does not touch the index file or the working tree at all (but
Junio C Hamanof2b280b2018-12-01 14:45:01823 resets the head to <code>&lt;commit&gt;</code>, just like all modes do). This leaves
824 all your changed files "Changes to be committed", as <code>git status</code>
Junio C Hamano657fd8a2010-10-07 00:01:24825 would put it.
Junio C Hamano1a4e8412005-12-27 08:17:23826</p>
827</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59828<dt class="hdlist1">
Junio C Hamanob5a296f2010-08-13 02:46:36829--mixed
830</dt>
831<dd>
832<p>
833 Resets the index but not the working tree (i.e., the changed files
834 are preserved but not marked for commit) and reports what has not
835 been updated. This is the default action.
836</p>
Junio C Hamanoc14e6ad2014-10-31 20:25:53837<div class="paragraph"><p>If <code>-N</code> is specified, removed paths are marked as intent-to-add (see
Junio C Hamano5b3533d2014-02-27 23:07:15838<a href="git-add.html">git-add(1)</a>).</p></div>
Junio C Hamanob5a296f2010-08-13 02:46:36839</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59840<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23841--hard
842</dt>
843<dd>
844<p>
Junio C Hamano657fd8a2010-10-07 00:01:24845 Resets the index and working tree. Any changes to tracked files in the
Junio C Hamano7b1585b2021-10-14 17:11:58846 working tree since <code>&lt;commit&gt;</code> are discarded. Any untracked files or
847 directories in the way of writing any tracked files are simply deleted.
Junio C Hamano1a4e8412005-12-27 08:17:23848</p>
849</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59850<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22851--merge
852</dt>
853<dd>
854<p>
Junio C Hamano657fd8a2010-10-07 00:01:24855 Resets the index and updates the files in the working tree that are
Junio C Hamanof2b280b2018-12-01 14:45:01856 different between <code>&lt;commit&gt;</code> and <code>HEAD</code>, but keeps those which are
Junio C Hamano657fd8a2010-10-07 00:01:24857 different between the index and working tree (i.e. which have changes
858 which have not been added).
Junio C Hamanof2b280b2018-12-01 14:45:01859 If a file that is different between <code>&lt;commit&gt;</code> and the index has
860 unstaged changes, reset is aborted.
Junio C Hamanobbbb8652008-12-29 10:34:22861</p>
Junio C Hamanof2b280b2018-12-01 14:45:01862<div class="paragraph"><p>In other words, <code>--merge</code> does something like a <code>git read-tree -u -m &lt;commit&gt;</code>,
Junio C Hamano68cf15a2010-11-06 01:01:59863but carries forward unmerged index entries.</p></div>
Junio C Hamanobbbb8652008-12-29 10:34:22864</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59865<dt class="hdlist1">
Junio C Hamano0299d922010-03-20 20:59:31866--keep
867</dt>
868<dd>
869<p>
Junio C Hamano20338b42011-01-22 00:51:59870 Resets index entries and updates files in the working tree that are
Junio C Hamanof2b280b2018-12-01 14:45:01871 different between <code>&lt;commit&gt;</code> and <code>HEAD</code>.
872 If a file that is different between <code>&lt;commit&gt;</code> and <code>HEAD</code> has local
873 changes, reset is aborted.
Junio C Hamano0299d922010-03-20 20:59:31874</p>
875</dd>
Junio C Hamano0dd50942020-04-29 21:21:05876<dt class="hdlist1">
877--[no-]recurse-submodules
878</dt>
879<dd>
880<p>
881 When the working tree is updated, using --recurse-submodules will
882 also recursively reset the working tree of all active submodules
883 according to the commit recorded in the superproject, also setting
884 the submodules' HEAD to be detached at that commit.
885</p>
886</dd>
Junio C Hamanob5a296f2010-08-13 02:46:36887</dl></div>
Junio C Hamano9d971152012-12-19 00:43:11888</div></div>
Junio C Hamanoc28068f2009-09-08 00:55:23889</dd>
Junio C Hamanob5a296f2010-08-13 02:46:36890</dl></div>
Junio C Hamanoc9f11c22019-07-10 02:54:04891<div class="paragraph"><p>See "Reset, restore and revert" in <a href="git.html">git(1)</a> for the differences
892between the three commands.</p></div>
Junio C Hamanob5a296f2010-08-13 02:46:36893</div>
Junio C Hamano9d971152012-12-19 00:43:11894</div>
895<div class="sect1">
Junio C Hamanob5a296f2010-08-13 02:46:36896<h2 id="_options">OPTIONS</h2>
897<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59898<div class="dlist"><dl>
899<dt class="hdlist1">
Junio C Hamano422cfec2007-11-08 08:07:45900-q
901</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59902<dt class="hdlist1">
Junio C Hamanob141a922010-01-10 19:55:14903--quiet
904</dt>
Junio C Hamano4bea0282022-04-04 18:21:49905<dd>
906<p>
907 Be quiet, only report errors.
908</p>
909</dd>
Junio C Hamano06ce83b2018-11-13 14:06:12910<dt class="hdlist1">
Junio C Hamano4bea0282022-04-04 18:21:49911--refresh
912</dt>
913<dt class="hdlist1">
914--no-refresh
Junio C Hamano06ce83b2018-11-13 14:06:12915</dt>
Junio C Hamano422cfec2007-11-08 08:07:45916<dd>
917<p>
Junio C Hamano4bea0282022-04-04 18:21:49918 Refresh the index after a mixed reset. Enabled by default.
Junio C Hamano422cfec2007-11-08 08:07:45919</p>
920</dd>
Junio C Hamanob4896852019-12-10 23:15:09921<dt class="hdlist1">
922--pathspec-from-file=&lt;file&gt;
923</dt>
924<dd>
925<p>
926 Pathspec is passed in <code>&lt;file&gt;</code> instead of commandline args. If
927 <code>&lt;file&gt;</code> is exactly <code>-</code> then standard input is used. Pathspec
928 elements are separated by LF or CR/LF. Pathspec elements can be
929 quoted as explained for the configuration variable <code>core.quotePath</code>
930 (see <a href="git-config.html">git-config(1)</a>). See also <code>--pathspec-file-nul</code> and
931 global <code>--literal-pathspecs</code>.
932</p>
933</dd>
934<dt class="hdlist1">
935--pathspec-file-nul
936</dt>
937<dd>
938<p>
939 Only meaningful with <code>--pathspec-from-file</code>. Pathspec elements are
940 separated with NUL character and all other characters are taken
941 literally (including newlines and quotes).
942</p>
943</dd>
944<dt class="hdlist1">
945--
946</dt>
947<dd>
948<p>
949 Do not interpret any more arguments as options.
950</p>
951</dd>
952<dt class="hdlist1">
953&lt;pathspec&gt;&#8230;
954</dt>
955<dd>
956<p>
957 Limits the paths affected by the operation.
958</p>
959<div class="paragraph"><p>For more details, see the <em>pathspec</em> entry in <a href="gitglossary.html">gitglossary(7)</a>.</p></div>
960</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31961</dl></div>
Junio C Hamano1bb569e2006-05-05 23:14:25962</div>
Junio C Hamano9d971152012-12-19 00:43:11963</div>
964<div class="sect1">
Junio C Hamanob5a296f2010-08-13 02:46:36965<h2 id="_examples">EXAMPLES</h2>
Junio C Hamano1bb569e2006-05-05 23:14:25966<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59967<div class="dlist"><dl>
968<dt class="hdlist1">
Junio C Hamano89d4e0f2007-02-18 00:34:59969Undo add
Junio C Hamano1a4e8412005-12-27 08:17:23970</dt>
971<dd>
972<div class="listingblock">
973<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:53974<pre><code>$ edit <b>&lt;1&gt;</b>
Junio C Hamano89d4e0f2007-02-18 00:34:59975$ git add frotz.c filfre.c
Junio C Hamano68cf15a2010-11-06 01:01:59976$ mailx <b>&lt;2&gt;</b>
977$ git reset <b>&lt;3&gt;</b>
Junio C Hamanoc14e6ad2014-10-31 20:25:53978$ git pull git://info.example.com/ nitfol <b>&lt;4&gt;</b></code></pre>
Junio C Hamanoc8d88c22006-04-29 07:02:01979</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59980<div class="colist arabic"><ol>
Junio C Hamanoc8d88c22006-04-29 07:02:01981<li>
982<p>
Junio C Hamano092f5f02007-08-02 07:23:38983You are happily working on something, and find the changes
Junio C Hamano2567b322019-02-05 23:33:56984 in these files are in good order. You do not want to see them
985 when you run <code>git diff</code>, because you plan to work on other files
986 and changes with these files are distracting.
Junio C Hamanoc8d88c22006-04-29 07:02:01987</p>
988</li>
989<li>
990<p>
Junio C Hamano535c65c2017-06-24 22:51:58991Somebody asks you to pull, and the changes sound worthy of merging.
Junio C Hamanoc8d88c22006-04-29 07:02:01992</p>
993</li>
994<li>
995<p>
Junio C Hamano092f5f02007-08-02 07:23:38996However, you already dirtied the index (i.e. your index does
Junio C Hamano2567b322019-02-05 23:33:56997 not match the <code>HEAD</code> commit). But you know the pull you are going
998 to make does not affect <code>frotz.c</code> or <code>filfre.c</code>, so you revert the
999 index changes for these two files. Your changes in working tree
1000 remain there.
Junio C Hamanoc8d88c22006-04-29 07:02:011001</p>
1002</li>
1003<li>
1004<p>
Junio C Hamanof2b280b2018-12-01 14:45:011005Then you can pull and merge, leaving <code>frotz.c</code> and <code>filfre.c</code>
Junio C Hamano2567b322019-02-05 23:33:561006 changes still in the working tree.
Junio C Hamanoc8d88c22006-04-29 07:02:011007</p>
1008</li>
Junio C Hamanoba4b9282008-07-06 05:20:311009</ol></div>
Junio C Hamano1a4e8412005-12-27 08:17:231010</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591011<dt class="hdlist1">
Junio C Hamanob5a296f2010-08-13 02:46:361012Undo a commit and redo
1013</dt>
1014<dd>
1015<div class="listingblock">
1016<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531017<pre><code>$ git commit ...
Junio C Hamano68cf15a2010-11-06 01:01:591018$ git reset --soft HEAD^ <b>&lt;1&gt;</b>
1019$ edit <b>&lt;2&gt;</b>
Junio C Hamanoc14e6ad2014-10-31 20:25:531020$ git commit -a -c ORIG_HEAD <b>&lt;3&gt;</b></code></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361021</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591022<div class="colist arabic"><ol>
Junio C Hamanob5a296f2010-08-13 02:46:361023<li>
1024<p>
1025This is most often done when you remembered what you
Junio C Hamano2567b322019-02-05 23:33:561026 just committed is incomplete, or you misspelled your commit
1027 message, or both. Leaves working tree as it was before "reset".
Junio C Hamanob5a296f2010-08-13 02:46:361028</p>
1029</li>
1030<li>
1031<p>
1032Make corrections to working tree files.
1033</p>
1034</li>
1035<li>
1036<p>
Junio C Hamanof2b280b2018-12-01 14:45:011037"reset" copies the old head to <code>.git/ORIG_HEAD</code>; redo the
Junio C Hamano2567b322019-02-05 23:33:561038 commit by starting with its log message. If you do not need to
1039 edit the message further, you can give <code>-C</code> option instead.
Junio C Hamanob5a296f2010-08-13 02:46:361040</p>
Junio C Hamanof2b280b2018-12-01 14:45:011041<div class="paragraph"><p>See also the <code>--amend</code> option to <a href="git-commit.html">git-commit(1)</a>.</p></div>
Junio C Hamanob5a296f2010-08-13 02:46:361042</li>
1043</ol></div>
1044</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591045<dt class="hdlist1">
Junio C Hamanob5a296f2010-08-13 02:46:361046Undo a commit, making it a topic branch
1047</dt>
1048<dd>
1049<div class="listingblock">
1050<div class="content">
Junio C Hamanoc9f11c22019-07-10 02:54:041051<pre><code>$ git branch topic/wip <b>&lt;1&gt;</b>
1052$ git reset --hard HEAD~3 <b>&lt;2&gt;</b>
1053$ git switch topic/wip <b>&lt;3&gt;</b></code></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361054</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591055<div class="colist arabic"><ol>
Junio C Hamanob5a296f2010-08-13 02:46:361056<li>
1057<p>
1058You have made some commits, but realize they were premature
Junio C Hamano2567b322019-02-05 23:33:561059 to be in the <code>master</code> branch. You want to continue polishing
1060 them in a topic branch, so create <code>topic/wip</code> branch off of the
1061 current <code>HEAD</code>.
Junio C Hamanob5a296f2010-08-13 02:46:361062</p>
1063</li>
1064<li>
1065<p>
1066Rewind the master branch to get rid of those three commits.
1067</p>
1068</li>
1069<li>
1070<p>
Junio C Hamanof2b280b2018-12-01 14:45:011071Switch to <code>topic/wip</code> branch and keep working.
Junio C Hamanob5a296f2010-08-13 02:46:361072</p>
1073</li>
1074</ol></div>
1075</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591076<dt class="hdlist1">
Junio C Hamanob5a296f2010-08-13 02:46:361077Undo commits permanently
1078</dt>
1079<dd>
1080<div class="listingblock">
1081<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531082<pre><code>$ git commit ...
1083$ git reset --hard HEAD~3 <b>&lt;1&gt;</b></code></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361084</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591085<div class="colist arabic"><ol>
Junio C Hamanob5a296f2010-08-13 02:46:361086<li>
1087<p>
Junio C Hamanof2b280b2018-12-01 14:45:011088The last three commits (<code>HEAD</code>, <code>HEAD^</code>, and <code>HEAD~2</code>) were bad
Junio C Hamano2567b322019-02-05 23:33:561089 and you do not want to ever see them again. Do <strong>not</strong> do this if
1090 you have already given these commits to somebody else. (See the
1091 "RECOVERING FROM UPSTREAM REBASE" section in <a href="git-rebase.html">git-rebase(1)</a>
1092 for the implications of doing so.)
Junio C Hamanob5a296f2010-08-13 02:46:361093</p>
1094</li>
1095</ol></div>
1096</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591097<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231098Undo a merge or pull
1099</dt>
1100<dd>
1101<div class="listingblock">
1102<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531103<pre><code>$ git pull <b>&lt;1&gt;</b>
Junio C Hamano1a4e8412005-12-27 08:17:231104Auto-merging nitfol
1105CONFLICT (content): Merge conflict in nitfol
Junio C Hamano6a3c8272008-12-19 21:38:181106Automatic merge failed; fix conflicts and then commit the result.
Junio C Hamano68cf15a2010-11-06 01:01:591107$ git reset --hard <b>&lt;2&gt;</b>
1108$ git pull . topic/branch <b>&lt;3&gt;</b>
Junio C Hamano1a4e8412005-12-27 08:17:231109Updating from 41223... to 13134...
Junio C Hamano3f680f32009-11-16 02:10:541110Fast-forward
Junio C Hamanoc14e6ad2014-10-31 20:25:531111$ git reset --hard ORIG_HEAD <b>&lt;4&gt;</b></code></pre>
Junio C Hamanoc8d88c22006-04-29 07:02:011112</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591113<div class="colist arabic"><ol>
Junio C Hamanoc8d88c22006-04-29 07:02:011114<li>
1115<p>
Junio C Hamano092f5f02007-08-02 07:23:381116Try to update from the upstream resulted in a lot of
Junio C Hamano2567b322019-02-05 23:33:561117 conflicts; you were not ready to spend a lot of time merging
1118 right now, so you decide to do that later.
Junio C Hamanoc8d88c22006-04-29 07:02:011119</p>
1120</li>
1121<li>
1122<p>
Junio C Hamanof2b280b2018-12-01 14:45:011123"pull" has not made merge commit, so <code>git reset --hard</code>
Junio C Hamano2567b322019-02-05 23:33:561124 which is a synonym for <code>git reset --hard HEAD</code> clears the mess
1125 from the index file and the working tree.
Junio C Hamanoc8d88c22006-04-29 07:02:011126</p>
1127</li>
1128<li>
1129<p>
Junio C Hamano092f5f02007-08-02 07:23:381130Merge a topic branch into the current branch, which resulted
Junio C Hamano2567b322019-02-05 23:33:561131 in a fast-forward.
Junio C Hamanoc8d88c22006-04-29 07:02:011132</p>
1133</li>
1134<li>
1135<p>
Junio C Hamano092f5f02007-08-02 07:23:381136But you decided that the topic branch is not ready for public
Junio C Hamano2567b322019-02-05 23:33:561137 consumption yet. "pull" or "merge" always leaves the original
1138 tip of the current branch in <code>ORIG_HEAD</code>, so resetting hard to it
1139 brings your index file and the working tree back to that state,
1140 and resets the tip of the branch to that commit.
Junio C Hamanoc8d88c22006-04-29 07:02:011141</p>
1142</li>
Junio C Hamanoba4b9282008-07-06 05:20:311143</ol></div>
Junio C Hamano1a4e8412005-12-27 08:17:231144</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591145<dt class="hdlist1">
Junio C Hamano657fd8a2010-10-07 00:01:241146Undo a merge or pull inside a dirty working tree
Junio C Hamanobbbb8652008-12-29 10:34:221147</dt>
1148<dd>
1149<div class="listingblock">
1150<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531151<pre><code>$ git pull <b>&lt;1&gt;</b>
Junio C Hamanobbbb8652008-12-29 10:34:221152Auto-merging nitfol
1153Merge made by recursive.
1154 nitfol | 20 +++++----
1155 ...
Junio C Hamanoc14e6ad2014-10-31 20:25:531156$ git reset --merge ORIG_HEAD <b>&lt;2&gt;</b></code></pre>
Junio C Hamanobbbb8652008-12-29 10:34:221157</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591158<div class="colist arabic"><ol>
Junio C Hamanobbbb8652008-12-29 10:34:221159<li>
1160<p>
1161Even if you may have local modifications in your
Junio C Hamano2567b322019-02-05 23:33:561162 working tree, you can safely say <code>git pull</code> when you know
1163 that the change in the other branch does not overlap with
1164 them.
Junio C Hamanobbbb8652008-12-29 10:34:221165</p>
1166</li>
1167<li>
1168<p>
1169After inspecting the result of the merge, you may find
Junio C Hamano2567b322019-02-05 23:33:561170 that the change in the other branch is unsatisfactory. Running
1171 <code>git reset --hard ORIG_HEAD</code> will let you go back to where you
1172 were, but it will discard your local changes, which you do not
1173 want. <code>git reset --merge</code> keeps your local changes.
Junio C Hamanobbbb8652008-12-29 10:34:221174</p>
1175</li>
1176</ol></div>
1177</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591178<dt class="hdlist1">
Junio C Hamano74e8a2d2006-01-14 03:58:411179Interrupted workflow
1180</dt>
1181<dd>
Junio C Hamano68cf15a2010-11-06 01:01:591182<div class="paragraph"><p>Suppose you are interrupted by an urgent fix request while you
Junio C Hamanoa6331a82006-01-22 07:50:331183are in the middle of a large change. The files in your
Junio C Hamano74e8a2d2006-01-14 03:58:411184working tree are not in any shape to be committed yet, but you
Junio C Hamanoba4b9282008-07-06 05:20:311185need to get to the other branch for a quick bugfix.</p></div>
Junio C Hamano74e8a2d2006-01-14 03:58:411186<div class="listingblock">
1187<div class="content">
Junio C Hamanoc9f11c22019-07-10 02:54:041188<pre><code>$ git switch feature ;# you were working in "feature" branch and
1189$ work work work ;# got interrupted
Junio C Hamano68cf15a2010-11-06 01:01:591190$ git commit -a -m "snapshot WIP" <b>&lt;1&gt;</b>
Junio C Hamanoc9f11c22019-07-10 02:54:041191$ git switch master
Junio C Hamano74e8a2d2006-01-14 03:58:411192$ fix fix fix
1193$ git commit ;# commit with real log
Junio C Hamanoc9f11c22019-07-10 02:54:041194$ git switch feature
Junio C Hamano68cf15a2010-11-06 01:01:591195$ git reset --soft HEAD^ ;# go back to WIP state <b>&lt;2&gt;</b>
Junio C Hamanoc14e6ad2014-10-31 20:25:531196$ git reset <b>&lt;3&gt;</b></code></pre>
Junio C Hamano74e8a2d2006-01-14 03:58:411197</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591198<div class="colist arabic"><ol>
Junio C Hamanoc8d88c22006-04-29 07:02:011199<li>
1200<p>
1201This commit will get blown away so a throw-away log message is OK.
1202</p>
1203</li>
1204<li>
1205<p>
1206This removes the <em>WIP</em> commit from the commit history, and sets
1207 your working tree to the state just before you made that snapshot.
1208</p>
1209</li>
1210<li>
1211<p>
1212At this point the index file still has all the WIP changes you
1213 committed as <em>snapshot WIP</em>. This updates the index to show your
1214 WIP files as uncommitted.
1215</p>
Junio C Hamanoa28a9202012-06-21 07:08:231216<div class="paragraph"><p>See also <a href="git-stash.html">git-stash(1)</a>.</p></div>
Junio C Hamanoc8d88c22006-04-29 07:02:011217</li>
Junio C Hamanoba4b9282008-07-06 05:20:311218</ol></div>
Junio C Hamano74e8a2d2006-01-14 03:58:411219</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591220<dt class="hdlist1">
Junio C Hamano26e590a2008-02-17 03:53:511221Reset a single file in the index
1222</dt>
1223<dd>
Junio C Hamano68cf15a2010-11-06 01:01:591224<div class="paragraph"><p>Suppose you have added a file to your index, but later decide you do not
Junio C Hamano26e590a2008-02-17 03:53:511225want to add it to your commit. You can remove the file from the index
Junio C Hamanoba4b9282008-07-06 05:20:311226while keeping your changes with git reset.</p></div>
Junio C Hamano26e590a2008-02-17 03:53:511227<div class="listingblock">
1228<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531229<pre><code>$ git reset -- frotz.c <b>&lt;1&gt;</b>
Junio C Hamano68cf15a2010-11-06 01:01:591230$ git commit -m "Commit files in index" <b>&lt;2&gt;</b>
Junio C Hamanoc14e6ad2014-10-31 20:25:531231$ git add frotz.c <b>&lt;3&gt;</b></code></pre>
Junio C Hamano26e590a2008-02-17 03:53:511232</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591233<div class="colist arabic"><ol>
Junio C Hamano26e590a2008-02-17 03:53:511234<li>
1235<p>
1236This removes the file from the index while keeping it in the working
1237 directory.
1238</p>
1239</li>
1240<li>
1241<p>
1242This commits all other changes in the index.
1243</p>
1244</li>
1245<li>
1246<p>
1247Adds the file to the index again.
1248</p>
1249</li>
Junio C Hamanoba4b9282008-07-06 05:20:311250</ol></div>
Junio C Hamano26e590a2008-02-17 03:53:511251</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591252<dt class="hdlist1">
Junio C Hamano0299d922010-03-20 20:59:311253Keep changes in working tree while discarding some previous commits
1254</dt>
1255<dd>
Junio C Hamano68cf15a2010-11-06 01:01:591256<div class="paragraph"><p>Suppose you are working on something and you commit it, and then you
Junio C Hamano0299d922010-03-20 20:59:311257continue working a bit more, but now you think that what you have in
1258your working tree should be in another branch that has nothing to do
Junio C Hamano619596a2010-08-18 22:15:351259with what you committed previously. You can start a new branch and
Junio C Hamano657fd8a2010-10-07 00:01:241260reset it while keeping the changes in your working tree.</p></div>
Junio C Hamano0299d922010-03-20 20:59:311261<div class="listingblock">
1262<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531263<pre><code>$ git tag start
Junio C Hamanoc9f11c22019-07-10 02:54:041264$ git switch -c branch1
Junio C Hamano0299d922010-03-20 20:59:311265$ edit
Junio C Hamano68cf15a2010-11-06 01:01:591266$ git commit ... <b>&lt;1&gt;</b>
Junio C Hamano0299d922010-03-20 20:59:311267$ edit
Junio C Hamanoc9f11c22019-07-10 02:54:041268$ git switch -c branch2 <b>&lt;2&gt;</b>
Junio C Hamanoc14e6ad2014-10-31 20:25:531269$ git reset --keep start <b>&lt;3&gt;</b></code></pre>
Junio C Hamano0299d922010-03-20 20:59:311270</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591271<div class="colist arabic"><ol>
Junio C Hamano0299d922010-03-20 20:59:311272<li>
1273<p>
Junio C Hamanof2b280b2018-12-01 14:45:011274This commits your first edits in <code>branch1</code>.
Junio C Hamano0299d922010-03-20 20:59:311275</p>
1276</li>
1277<li>
1278<p>
1279In the ideal world, you could have realized that the earlier
1280 commit did not belong to the new topic when you created and switched
Junio C Hamanoc9f11c22019-07-10 02:54:041281 to <code>branch2</code> (i.e. <code>git switch -c branch2 start</code>), but nobody is
Junio C Hamano0299d922010-03-20 20:59:311282 perfect.
1283</p>
1284</li>
1285<li>
1286<p>
Junio C Hamanof2b280b2018-12-01 14:45:011287But you can use <code>reset --keep</code> to remove the unwanted commit after
1288 you switched to <code>branch2</code>.
Junio C Hamano0299d922010-03-20 20:59:311289</p>
1290</li>
1291</ol></div>
1292</dd>
Junio C Hamanoe89102f2017-02-15 23:18:151293<dt class="hdlist1">
Junio C Hamanoce01de82017-02-16 22:59:121294Split a commit apart into a sequence of commits
Junio C Hamanoe89102f2017-02-15 23:18:151295</dt>
1296<dd>
Junio C Hamano967cda72017-06-30 21:49:531297<div class="paragraph"><p>Suppose that you have created lots of logically separate changes and committed
Junio C Hamanoce01de82017-02-16 22:59:121298them together. Then, later you decide that it might be better to have each
1299logical chunk associated with its own commit. You can use git reset to rewind
1300history without changing the contents of your local files, and then successively
1301use <code>git add -p</code> to interactively select which hunks to include into each commit,
1302using <code>git commit -c</code> to pre-populate the commit message.</p></div>
Junio C Hamanoe89102f2017-02-15 23:18:151303<div class="listingblock">
1304<div class="content">
Junio C Hamanoce01de82017-02-16 22:59:121305<pre><code>$ git reset -N HEAD^ <b>&lt;1&gt;</b>
Junio C Hamanoe89102f2017-02-15 23:18:151306$ git add -p <b>&lt;2&gt;</b>
1307$ git diff --cached <b>&lt;3&gt;</b>
1308$ git commit -c HEAD@{1} <b>&lt;4&gt;</b>
Junio C Hamanoce01de82017-02-16 22:59:121309... <b>&lt;5&gt;</b>
1310$ git add ... <b>&lt;6&gt;</b>
1311$ git diff --cached <b>&lt;7&gt;</b>
1312$ git commit ... <b>&lt;8&gt;</b></code></pre>
Junio C Hamanoe89102f2017-02-15 23:18:151313</div></div>
1314<div class="colist arabic"><ol>
1315<li>
1316<p>
1317First, reset the history back one commit so that we remove the original
Junio C Hamanoce01de82017-02-16 22:59:121318 commit, but leave the working tree with all the changes. The -N ensures
Junio C Hamanof2b280b2018-12-01 14:45:011319 that any new files added with <code>HEAD</code> are still marked so that <code>git add -p</code>
Junio C Hamanoce01de82017-02-16 22:59:121320 will find them.
Junio C Hamanoe89102f2017-02-15 23:18:151321</p>
1322</li>
1323<li>
1324<p>
Junio C Hamanof2b280b2018-12-01 14:45:011325Next, we interactively select diff hunks to add using the <code>git add -p</code>
Junio C Hamanoce01de82017-02-16 22:59:121326 facility. This will ask you about each diff hunk in sequence and you can
1327 use simple commands such as "yes, include this", "No don&#8217;t include this"
1328 or even the very powerful "edit" facility.
Junio C Hamanoe89102f2017-02-15 23:18:151329</p>
1330</li>
1331<li>
1332<p>
Junio C Hamanoce01de82017-02-16 22:59:121333Once satisfied with the hunks you want to include, you should verify what
Junio C Hamanof2b280b2018-12-01 14:45:011334 has been prepared for the first commit by using <code>git diff --cached</code>. This
Junio C Hamanoce01de82017-02-16 22:59:121335 shows all the changes that have been moved into the index and are about
1336 to be committed.
Junio C Hamanoe89102f2017-02-15 23:18:151337</p>
1338</li>
1339<li>
1340<p>
Junio C Hamanof2b280b2018-12-01 14:45:011341Next, commit the changes stored in the index. The <code>-c</code> option specifies to
Junio C Hamanoce01de82017-02-16 22:59:121342 pre-populate the commit message from the original message that you started
Junio C Hamanof2b280b2018-12-01 14:45:011343 with in the first commit. This is helpful to avoid retyping it. The
1344 <code>HEAD@{1}</code> is a special notation for the commit that <code>HEAD</code> used to be at
1345 prior to the original reset commit (1 change ago).
1346 See <a href="git-reflog.html">git-reflog(1)</a> for more details. You may also use any other
1347 valid commit reference.
Junio C Hamanoe89102f2017-02-15 23:18:151348</p>
1349</li>
1350<li>
1351<p>
Junio C Hamanoce01de82017-02-16 22:59:121352You can repeat steps 2-4 multiple times to break the original code into
1353 any number of commits.
Junio C Hamanoe89102f2017-02-15 23:18:151354</p>
1355</li>
1356<li>
1357<p>
Junio C Hamanoce01de82017-02-16 22:59:121358Now you&#8217;ve split out many of the changes into their own commits, and might
Junio C Hamanof2b280b2018-12-01 14:45:011359 no longer use the patch mode of <code>git add</code>, in order to select all remaining
Junio C Hamanoce01de82017-02-16 22:59:121360 uncommitted changes.
Junio C Hamanoe89102f2017-02-15 23:18:151361</p>
1362</li>
1363<li>
1364<p>
Junio C Hamanoce01de82017-02-16 22:59:121365Once again, check to verify that you&#8217;ve included what you want to. You may
1366 also wish to verify that git diff doesn&#8217;t show any remaining changes to be
1367 committed later.
1368</p>
1369</li>
1370<li>
1371<p>
1372And finally create the final commit.
Junio C Hamanoe89102f2017-02-15 23:18:151373</p>
1374</li>
1375</ol></div>
1376</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311377</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231378</div>
Junio C Hamano9d971152012-12-19 00:43:111379</div>
1380<div class="sect1">
Junio C Hamanob5a296f2010-08-13 02:46:361381<h2 id="_discussion">DISCUSSION</h2>
1382<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591383<div class="paragraph"><p>The tables below show what happens when running:</p></div>
Junio C Hamanob5a296f2010-08-13 02:46:361384<div class="listingblock">
1385<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531386<pre><code>git reset --option target</code></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361387</div></div>
Junio C Hamanof2b280b2018-12-01 14:45:011388<div class="paragraph"><p>to reset the <code>HEAD</code> to another commit (<code>target</code>) with the different
Junio C Hamanob5a296f2010-08-13 02:46:361389reset options depending on the state of the files.</p></div>
Junio C Hamanof2b280b2018-12-01 14:45:011390<div class="paragraph"><p>In these tables, <code>A</code>, <code>B</code>, <code>C</code> and <code>D</code> are some different states of a
Junio C Hamanob5a296f2010-08-13 02:46:361391file. For example, the first line of the first table means that if a
Junio C Hamanof2b280b2018-12-01 14:45:011392file is in state <code>A</code> in the working tree, in state <code>B</code> in the index, in
1393state <code>C</code> in <code>HEAD</code> and in state <code>D</code> in the target, then <code>git reset --soft
1394target</code> will leave the file in the working tree in state <code>A</code> and in the
1395index in state <code>B</code>. It resets (i.e. moves) the <code>HEAD</code> (i.e. the tip of
1396the current branch, if you are on one) to <code>target</code> (which has the file
1397in state <code>D</code>).</p></div>
Junio C Hamanob5a296f2010-08-13 02:46:361398<div class="literalblock">
1399<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531400<pre><code>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361401----------------------------------------------------
1402 A B C D --soft A B D
1403 --mixed A D D
1404 --hard D D D
1405 --merge (disallowed)
Junio C Hamanoc14e6ad2014-10-31 20:25:531406 --keep (disallowed)</code></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361407</div></div>
1408<div class="literalblock">
1409<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531410<pre><code>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361411----------------------------------------------------
1412 A B C C --soft A B C
1413 --mixed A C C
1414 --hard C C C
1415 --merge (disallowed)
Junio C Hamanoc14e6ad2014-10-31 20:25:531416 --keep A C C</code></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361417</div></div>
1418<div class="literalblock">
1419<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531420<pre><code>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361421----------------------------------------------------
1422 B B C D --soft B B D
1423 --mixed B D D
1424 --hard D D D
1425 --merge D D D
Junio C Hamanoc14e6ad2014-10-31 20:25:531426 --keep (disallowed)</code></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361427</div></div>
1428<div class="literalblock">
1429<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531430<pre><code>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361431----------------------------------------------------
1432 B B C C --soft B B C
1433 --mixed B C C
1434 --hard C C C
1435 --merge C C C
Junio C Hamanoc14e6ad2014-10-31 20:25:531436 --keep B C C</code></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361437</div></div>
1438<div class="literalblock">
1439<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531440<pre><code>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361441----------------------------------------------------
1442 B C C D --soft B C D
1443 --mixed B D D
1444 --hard D D D
1445 --merge (disallowed)
Junio C Hamanoc14e6ad2014-10-31 20:25:531446 --keep (disallowed)</code></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361447</div></div>
1448<div class="literalblock">
1449<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531450<pre><code>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361451----------------------------------------------------
1452 B C C C --soft B C C
1453 --mixed B C C
1454 --hard C C C
1455 --merge B C C
Junio C Hamanoc14e6ad2014-10-31 20:25:531456 --keep B C C</code></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361457</div></div>
Junio C Hamanof2b280b2018-12-01 14:45:011458<div class="paragraph"><p><code>reset --merge</code> is meant to be used when resetting out of a conflicted
Junio C Hamano657fd8a2010-10-07 00:01:241459merge. Any mergy operation guarantees that the working tree file that is
Junio C Hamanoe0f71462019-04-09 17:54:451460involved in the merge does not have a local change with respect to the index
1461before it starts, and that it writes the result out to the working tree. So if
Junio C Hamanob5a296f2010-08-13 02:46:361462we see some difference between the index and the target and also
Junio C Hamano657fd8a2010-10-07 00:01:241463between the index and the working tree, then it means that we are not
Junio C Hamanob5a296f2010-08-13 02:46:361464resetting out from a state that a mergy operation left after failing
Junio C Hamanof2b280b2018-12-01 14:45:011465with a conflict. That is why we disallow <code>--merge</code> option in this case.</p></div>
1466<div class="paragraph"><p><code>reset --keep</code> is meant to be used when removing some of the last
Junio C Hamanob5a296f2010-08-13 02:46:361467commits in the current branch while keeping changes in the working
1468tree. If there could be conflicts between the changes in the commit we
1469want to remove and the changes in the working tree we want to keep,
Junio C Hamano68cf15a2010-11-06 01:01:591470the reset is disallowed. That&#8217;s why it is disallowed if there are both
Junio C Hamanof2b280b2018-12-01 14:45:011471changes between the working tree and <code>HEAD</code>, and between <code>HEAD</code> and the
Junio C Hamanob5a296f2010-08-13 02:46:361472target. To be safe, it is also disallowed when there are unmerged
1473entries.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591474<div class="paragraph"><p>The following tables show what happens when there are unmerged
Junio C Hamanob5a296f2010-08-13 02:46:361475entries:</p></div>
1476<div class="literalblock">
1477<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531478<pre><code>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361479----------------------------------------------------
1480 X U A B --soft (disallowed)
1481 --mixed X B B
1482 --hard B B B
1483 --merge B B B
Junio C Hamanoc14e6ad2014-10-31 20:25:531484 --keep (disallowed)</code></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361485</div></div>
1486<div class="literalblock">
1487<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:531488<pre><code>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361489----------------------------------------------------
1490 X U A A --soft (disallowed)
1491 --mixed X A A
1492 --hard A A A
1493 --merge A A A
Junio C Hamanoc14e6ad2014-10-31 20:25:531494 --keep (disallowed)</code></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361495</div></div>
Junio C Hamanof2b280b2018-12-01 14:45:011496<div class="paragraph"><p><code>X</code> means any state and <code>U</code> means an unmerged index.</p></div>
Junio C Hamanob5a296f2010-08-13 02:46:361497</div>
Junio C Hamano9d971152012-12-19 00:43:111498</div>
1499<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311500<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231501<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231502<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231503</div>
Junio C Hamano7bd050f2011-09-22 06:32:221504</div>
Junio C Hamano9d971152012-12-19 00:43:111505</div>
Junio C Hamano7bd050f2011-09-22 06:32:221506<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:231507<div id="footer">
1508<div id="footer-text">
Junio C Hamano2ef0ba32018-01-26 23:13:531509Last updated
Junio C Hamanoa7b2c102023-06-13 21:00:151510 2023-01-21 17:52:14 PST
Junio C Hamano1a4e8412005-12-27 08:17:231511</div>
1512</div>
1513</body>
1514</html>