blob: 1a20354821ce4d60d4fa1b5c33376dc4ae08c79e [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!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 Hamano9d971152012-12-19 00:43:115<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
Junio C Hamano61525f92014-01-17 22:46:496<meta name="generator" content="AsciiDoc 8.6.6" />
Junio C Hamano68cf15a2010-11-06 01:01:597<title>git-reset(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:238<style type="text/css">
Junio C Hamano9d971152012-12-19 00:43:119/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
10
11/* Default font. */
12body {
13 font-family: Georgia,serif;
14}
15
16/* Title font. */
17h1, h2, h3, h4, h5, h6,
18div.title, caption.title,
19thead, p.table.header,
20#toctitle,
21#author, #revnumber, #revdate, #revremark,
22#footer {
23 font-family: Arial,Helvetica,sans-serif;
Junio C Hamano1a4e8412005-12-27 08:17:2324}
25
26body {
27 margin: 1em 5% 1em 5%;
28}
29
Junio C Hamanoba4b9282008-07-06 05:20:3130a {
31 color: blue;
32 text-decoration: underline;
33}
34a:visited {
35 color: fuchsia;
36}
Junio C Hamano1a4e8412005-12-27 08:17:2337
38em {
39 font-style: italic;
Junio C Hamano68cf15a2010-11-06 01:01:5940 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2341}
42
43strong {
44 font-weight: bold;
Junio C Hamano68cf15a2010-11-06 01:01:5945 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2346}
47
Junio C Hamano1a4e8412005-12-27 08:17:2348h1, h2, h3, h4, h5, h6 {
49 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:2350 margin-top: 1.2em;
51 margin-bottom: 0.5em;
52 line-height: 1.3;
53}
54
Junio C Hamanoba4b9282008-07-06 05:20:3155h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2356 border-bottom: 2px solid silver;
57}
58h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2359 padding-top: 0.5em;
60}
Junio C Hamanoba4b9282008-07-06 05:20:3161h3 {
62 float: left;
63}
64h3 + * {
65 clear: left;
66}
Junio C Hamano9d971152012-12-19 00:43:1167h5 {
68 font-size: 1.0em;
69}
Junio C Hamano1a4e8412005-12-27 08:17:2370
71div.sectionbody {
Junio C Hamano1a4e8412005-12-27 08:17:2372 margin-left: 0;
73}
74
75hr {
76 border: 1px solid silver;
77}
78
79p {
80 margin-top: 0.5em;
81 margin-bottom: 0.5em;
82}
83
Junio C Hamano68cf15a2010-11-06 01:01:5984ul, ol, li > p {
85 margin-top: 0;
86}
Junio C Hamano9d971152012-12-19 00:43:1187ul > li { color: #aaa; }
88ul > li > * { color: black; }
Junio C Hamano68cf15a2010-11-06 01:01:5989
Junio C Hamano61525f92014-01-17 22:46:4990pre {
Junio C Hamano1a4e8412005-12-27 08:17:2391 padding: 0;
92 margin: 0;
93}
94
Junio C Hamano9d971152012-12-19 00:43:1195#author {
Junio C Hamano1a4e8412005-12-27 08:17:2396 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:2397 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3198 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2399}
Junio C Hamano9d971152012-12-19 00:43:11100#email {
Junio C Hamano1a4e8412005-12-27 08:17:23101}
Junio C Hamano9d971152012-12-19 00:43:11102#revnumber, #revdate, #revremark {
Junio C Hamano1a4e8412005-12-27 08:17:23103}
104
Junio C Hamano9d971152012-12-19 00:43:11105#footer {
Junio C Hamano1a4e8412005-12-27 08:17:23106 font-size: small;
107 border-top: 2px solid silver;
108 padding-top: 0.5em;
109 margin-top: 4.0em;
110}
Junio C Hamano9d971152012-12-19 00:43:11111#footer-text {
Junio C Hamano1a4e8412005-12-27 08:17:23112 float: left;
113 padding-bottom: 0.5em;
114}
Junio C Hamano9d971152012-12-19 00:43:11115#footer-badges {
Junio C Hamano1a4e8412005-12-27 08:17:23116 float: right;
117 padding-bottom: 0.5em;
118}
119
Junio C Hamano9d971152012-12-19 00:43:11120#preamble {
Junio C Hamano68cf15a2010-11-06 01:01:59121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
123}
Junio C Hamano9d971152012-12-19 00:43:11124div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamano1a4e8412005-12-27 08:17:23125div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
126div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22127 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23128 margin-bottom: 1.5em;
129}
130div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22131 margin-top: 2.0em;
132 margin-bottom: 2.0em;
133 margin-right: 10%;
134 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23135}
136
137div.content { /* Block element content. */
138 padding: 0;
139}
140
141/* Block element titles. */
142div.title, caption.title {
Junio C Hamano68cf15a2010-11-06 01:01:59143 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23144 font-weight: bold;
145 text-align: left;
146 margin-top: 1.0em;
147 margin-bottom: 0.5em;
148}
149div.title + * {
150 margin-top: 0;
151}
152
153td div.title:first-child {
154 margin-top: 0.0em;
155}
156div.content div.title:first-child {
157 margin-top: 0.0em;
158}
159div.content + div.title {
160 margin-top: 0.0em;
161}
162
163div.sidebarblock > div.content {
164 background: #ffffee;
Junio C Hamano9d971152012-12-19 00:43:11165 border: 1px solid #dddddd;
166 border-left: 4px solid #f0f0f0;
Junio C Hamano1a4e8412005-12-27 08:17:23167 padding: 0.5em;
168}
169
170div.listingblock > div.content {
Junio C Hamano9d971152012-12-19 00:43:11171 border: 1px solid #dddddd;
172 border-left: 5px solid #f0f0f0;
173 background: #f8f8f8;
Junio C Hamano1a4e8412005-12-27 08:17:23174 padding: 0.5em;
175}
176
Junio C Hamano7bd050f2011-09-22 06:32:22177div.quoteblock, div.verseblock {
178 padding-left: 1.0em;
179 margin-left: 1.0em;
Junio C Hamano68cf15a2010-11-06 01:01:59180 margin-right: 10%;
Junio C Hamano9d971152012-12-19 00:43:11181 border-left: 5px solid #f0f0f0;
182 color: #888;
Junio C Hamano1a4e8412005-12-27 08:17:23183}
Junio C Hamano7bd050f2011-09-22 06:32:22184
Junio C Hamano68cf15a2010-11-06 01:01:59185div.quoteblock > div.attribution {
186 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23187 text-align: right;
188}
Junio C Hamano68cf15a2010-11-06 01:01:59189
Junio C Hamano9d971152012-12-19 00:43:11190div.verseblock > pre.content {
191 font-family: inherit;
192 font-size: inherit;
Junio C Hamano68cf15a2010-11-06 01:01:59193}
194div.verseblock > div.attribution {
195 padding-top: 0.75em;
196 text-align: left;
197}
198/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31199div.verseblock + div.attribution {
200 text-align: left;
201}
Junio C Hamano1a4e8412005-12-27 08:17:23202
203div.admonitionblock .icon {
204 vertical-align: top;
205 font-size: 1.1em;
206 font-weight: bold;
207 text-decoration: underline;
208 color: #527bbd;
209 padding-right: 0.5em;
210}
211div.admonitionblock td.content {
212 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22213 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23214}
215
216div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22217 border-left: 3px solid #dddddd;
218 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23219}
220
Junio C Hamano1a4e8412005-12-27 08:17:23221div.imageblock div.content { padding-left: 0; }
Junio C Hamano1a4e8412005-12-27 08:17:23222span.image img { border-style: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59223a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23224
225dl {
226 margin-top: 0.8em;
227 margin-bottom: 0.8em;
228}
229dt {
230 margin-top: 0.5em;
231 margin-bottom: 0;
Junio C Hamano68cf15a2010-11-06 01:01:59232 font-style: normal;
233 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23234}
235dd > *:first-child {
Junio C Hamano68cf15a2010-11-06 01:01:59236 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23237}
238
239ul, ol {
240 list-style-position: outside;
241}
Junio C Hamano68cf15a2010-11-06 01:01:59242ol.arabic {
243 list-style-type: decimal;
244}
245ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23246 list-style-type: lower-alpha;
247}
Junio C Hamano68cf15a2010-11-06 01:01:59248ol.upperalpha {
249 list-style-type: upper-alpha;
250}
251ol.lowerroman {
252 list-style-type: lower-roman;
253}
254ol.upperroman {
255 list-style-type: upper-roman;
256}
257
258div.compact ul, div.compact ol,
259div.compact p, div.compact p,
260div.compact div, div.compact div {
261 margin-top: 0.1em;
262 margin-bottom: 0.1em;
263}
Junio C Hamano1a4e8412005-12-27 08:17:23264
Junio C Hamano1a4e8412005-12-27 08:17:23265tfoot {
266 font-weight: bold;
267}
Junio C Hamano68cf15a2010-11-06 01:01:59268td > div.verse {
269 white-space: pre;
270}
Junio C Hamano68cf15a2010-11-06 01:01:59271
272div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23273 margin-top: 0.8em;
274 margin-bottom: 0.8em;
275}
Junio C Hamano68cf15a2010-11-06 01:01:59276div.hdlist tr {
277 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31278}
Junio C Hamano68cf15a2010-11-06 01:01:59279dt.hdlist1.strong, td.hdlist1.strong {
280 font-weight: bold;
281}
282td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23283 vertical-align: top;
Junio C Hamano68cf15a2010-11-06 01:01:59284 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23285 padding-right: 0.8em;
Junio C Hamano68cf15a2010-11-06 01:01:59286 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23287}
Junio C Hamano68cf15a2010-11-06 01:01:59288td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23289 vertical-align: top;
290}
Junio C Hamano68cf15a2010-11-06 01:01:59291div.hdlist.compact tr {
292 margin: 0;
293 padding-bottom: 0;
294}
295
296.comment {
297 background: yellow;
298}
Junio C Hamano1a4e8412005-12-27 08:17:23299
Junio C Hamano7bd050f2011-09-22 06:32:22300.footnote, .footnoteref {
301 font-size: 0.8em;
302}
303
304span.footnote, span.footnoteref {
305 vertical-align: super;
306}
307
308#footnotes {
309 margin: 20px 0 20px 0;
310 padding: 7px 0 0 0;
311}
312
313#footnotes div.footnote {
314 margin: 0 0 5px 0;
315}
316
317#footnotes hr {
318 border: none;
319 border-top: 1px solid silver;
320 height: 1px;
321 text-align: left;
322 margin-left: 0;
323 width: 20%;
324 min-width: 100px;
325}
326
Junio C Hamano9d971152012-12-19 00:43:11327div.colist td {
328 padding-right: 0.5em;
329 padding-bottom: 0.3em;
330 vertical-align: top;
331}
332div.colist td img {
333 margin-top: 0.3em;
Junio C Hamano1a4e8412005-12-27 08:17:23334}
Junio C Hamanoba4b9282008-07-06 05:20:31335
Junio C Hamano9d971152012-12-19 00:43:11336@media print {
337 #footer-badges { display: none; }
338}
339
340#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22341 margin-bottom: 2.5em;
342}
343
Junio C Hamano9d971152012-12-19 00:43:11344#toctitle {
Junio C Hamanoba4b9282008-07-06 05:20:31345 color: #527bbd;
Junio C Hamanoba4b9282008-07-06 05:20:31346 font-size: 1.1em;
347 font-weight: bold;
348 margin-top: 1.0em;
349 margin-bottom: 0.1em;
350}
351
Junio C Hamano61525f92014-01-17 22:46:49352div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamanoba4b9282008-07-06 05:20:31353 margin-top: 0;
354 margin-bottom: 0;
355}
356div.toclevel2 {
357 margin-left: 2em;
358 font-size: 0.9em;
359}
360div.toclevel3 {
361 margin-left: 4em;
362 font-size: 0.9em;
363}
364div.toclevel4 {
365 margin-left: 6em;
366 font-size: 0.9em;
367}
Junio C Hamano9d971152012-12-19 00:43:11368
369span.aqua { color: aqua; }
370span.black { color: black; }
371span.blue { color: blue; }
372span.fuchsia { color: fuchsia; }
373span.gray { color: gray; }
374span.green { color: green; }
375span.lime { color: lime; }
376span.maroon { color: maroon; }
377span.navy { color: navy; }
378span.olive { color: olive; }
379span.purple { color: purple; }
380span.red { color: red; }
381span.silver { color: silver; }
382span.teal { color: teal; }
383span.white { color: white; }
384span.yellow { color: yellow; }
385
386span.aqua-background { background: aqua; }
387span.black-background { background: black; }
388span.blue-background { background: blue; }
389span.fuchsia-background { background: fuchsia; }
390span.gray-background { background: gray; }
391span.green-background { background: green; }
392span.lime-background { background: lime; }
393span.maroon-background { background: maroon; }
394span.navy-background { background: navy; }
395span.olive-background { background: olive; }
396span.purple-background { background: purple; }
397span.red-background { background: red; }
398span.silver-background { background: silver; }
399span.teal-background { background: teal; }
400span.white-background { background: white; }
401span.yellow-background { background: yellow; }
402
403span.big { font-size: 2em; }
404span.small { font-size: 0.6em; }
405
406span.underline { text-decoration: underline; }
407span.overline { text-decoration: overline; }
408span.line-through { text-decoration: line-through; }
409
Junio C Hamano9d971152012-12-19 00:43:11410
411/*
412 * xhtml11 specific
413 *
414 * */
415
Junio C Hamano61525f92014-01-17 22:46:49416tt {
417 font-family: monospace;
418 font-size: inherit;
419 color: navy;
420}
421
Junio C Hamano9d971152012-12-19 00:43:11422div.tableblock {
423 margin-top: 1.0em;
424 margin-bottom: 1.5em;
425}
426div.tableblock > table {
427 border: 3px solid #527bbd;
428}
429thead, p.table.header {
430 font-weight: bold;
431 color: #527bbd;
432}
433p.table {
434 margin-top: 0;
435}
436/* Because the table frame attribute is overriden by CSS in most browsers. */
437div.tableblock > table[frame="void"] {
438 border-style: none;
439}
440div.tableblock > table[frame="hsides"] {
441 border-left-style: none;
442 border-right-style: none;
443}
444div.tableblock > table[frame="vsides"] {
445 border-top-style: none;
446 border-bottom-style: none;
447}
448
449
450/*
451 * html5 specific
452 *
453 * */
454
Junio C Hamano61525f92014-01-17 22:46:49455.monospaced {
456 font-family: monospace;
457 font-size: inherit;
458 color: navy;
459}
460
Junio C Hamano9d971152012-12-19 00:43:11461table.tableblock {
462 margin-top: 1.0em;
463 margin-bottom: 1.5em;
464}
465thead, p.tableblock.header {
466 font-weight: bold;
467 color: #527bbd;
468}
469p.tableblock {
470 margin-top: 0;
471}
472table.tableblock {
473 border-width: 3px;
474 border-spacing: 0px;
475 border-style: solid;
476 border-color: #527bbd;
477 border-collapse: collapse;
478}
479th.tableblock, td.tableblock {
480 border-width: 1px;
481 padding: 4px;
482 border-style: solid;
483 border-color: #527bbd;
484}
485
486table.tableblock.frame-topbot {
487 border-left-style: hidden;
488 border-right-style: hidden;
489}
490table.tableblock.frame-sides {
491 border-top-style: hidden;
492 border-bottom-style: hidden;
493}
494table.tableblock.frame-none {
495 border-style: hidden;
496}
497
498th.tableblock.halign-left, td.tableblock.halign-left {
499 text-align: left;
500}
501th.tableblock.halign-center, td.tableblock.halign-center {
502 text-align: center;
503}
504th.tableblock.halign-right, td.tableblock.halign-right {
505 text-align: right;
506}
507
508th.tableblock.valign-top, td.tableblock.valign-top {
509 vertical-align: top;
510}
511th.tableblock.valign-middle, td.tableblock.valign-middle {
512 vertical-align: middle;
513}
514th.tableblock.valign-bottom, td.tableblock.valign-bottom {
515 vertical-align: bottom;
516}
517
518
519/*
520 * manpage specific
521 *
522 * */
523
524body.manpage h1 {
Junio C Hamano68cf15a2010-11-06 01:01:59525 padding-top: 0.5em;
526 padding-bottom: 0.5em;
527 border-top: 2px solid silver;
528 border-bottom: 2px solid silver;
529}
Junio C Hamano9d971152012-12-19 00:43:11530body.manpage h2 {
Junio C Hamano68cf15a2010-11-06 01:01:59531 border-style: none;
532}
Junio C Hamano9d971152012-12-19 00:43:11533body.manpage div.sectionbody {
534 margin-left: 3em;
Junio C Hamano68cf15a2010-11-06 01:01:59535}
536
537@media print {
Junio C Hamano9d971152012-12-19 00:43:11538 body.manpage div#toc { display: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59539}
Junio C Hamano1a4e8412005-12-27 08:17:23540</style>
Junio C Hamano7bd050f2011-09-22 06:32:22541<script type="text/javascript">
542/*<![CDATA[*/
Junio C Hamano7bd050f2011-09-22 06:32:22543var asciidoc = { // Namespace.
544
545/////////////////////////////////////////////////////////////////////
546// Table Of Contents generator
547/////////////////////////////////////////////////////////////////////
548
549/* Author: Mihai Bazon, September 2002
550 * http://students.infoiasi.ro/~mishoo
551 *
552 * Table Of Content generator
553 * Version: 0.4
554 *
555 * Feel free to use this script under the terms of the GNU General Public
556 * License, as long as you do not remove or alter this notice.
557 */
558
559 /* modified by Troy D. Hanson, September 2006. License: GPL */
560 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
561
562// toclevels = 1..4.
563toc: function (toclevels) {
564
565 function getText(el) {
566 var text = "";
567 for (var i = el.firstChild; i != null; i = i.nextSibling) {
568 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
569 text += i.data;
570 else if (i.firstChild != null)
571 text += getText(i);
572 }
573 return text;
574 }
575
576 function TocEntry(el, text, toclevel) {
577 this.element = el;
578 this.text = text;
579 this.toclevel = toclevel;
580 }
581
582 function tocEntries(el, toclevels) {
583 var result = new Array;
Junio C Hamano61525f92014-01-17 22:46:49584 var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
Junio C Hamano7bd050f2011-09-22 06:32:22585 // Function that scans the DOM tree for header elements (the DOM2
586 // nodeIterator API would be a better technique but not supported by all
587 // browsers).
588 var iterate = function (el) {
589 for (var i = el.firstChild; i != null; i = i.nextSibling) {
590 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
591 var mo = re.exec(i.tagName);
592 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
593 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
594 }
595 iterate(i);
596 }
597 }
598 }
599 iterate(el);
600 return result;
601 }
602
603 var toc = document.getElementById("toc");
Junio C Hamano9d971152012-12-19 00:43:11604 if (!toc) {
605 return;
606 }
607
608 // Delete existing TOC entries in case we're reloading the TOC.
609 var tocEntriesToRemove = [];
610 var i;
611 for (i = 0; i < toc.childNodes.length; i++) {
612 var entry = toc.childNodes[i];
Junio C Hamano61525f92014-01-17 22:46:49613 if (entry.nodeName == 'div'
Junio C Hamano9d971152012-12-19 00:43:11614 && entry.getAttribute("class")
615 && entry.getAttribute("class").match(/^toclevel/))
616 tocEntriesToRemove.push(entry);
617 }
618 for (i = 0; i < tocEntriesToRemove.length; i++) {
619 toc.removeChild(tocEntriesToRemove[i]);
620 }
621
622 // Rebuild TOC entries.
Junio C Hamano7bd050f2011-09-22 06:32:22623 var entries = tocEntries(document.getElementById("content"), toclevels);
624 for (var i = 0; i < entries.length; ++i) {
625 var entry = entries[i];
626 if (entry.element.id == "")
627 entry.element.id = "_toc_" + i;
628 var a = document.createElement("a");
629 a.href = "#" + entry.element.id;
630 a.appendChild(document.createTextNode(entry.text));
631 var div = document.createElement("div");
632 div.appendChild(a);
633 div.className = "toclevel" + entry.toclevel;
634 toc.appendChild(div);
635 }
636 if (entries.length == 0)
637 toc.parentNode.removeChild(toc);
638},
639
640
641/////////////////////////////////////////////////////////////////////
642// Footnotes generator
643/////////////////////////////////////////////////////////////////////
644
645/* Based on footnote generation code from:
646 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
647 */
648
649footnotes: function () {
Junio C Hamano9d971152012-12-19 00:43:11650 // Delete existing footnote entries in case we're reloading the footnodes.
651 var i;
Junio C Hamano7bd050f2011-09-22 06:32:22652 var noteholder = document.getElementById("footnotes");
Junio C Hamano9d971152012-12-19 00:43:11653 if (!noteholder) {
654 return;
655 }
656 var entriesToRemove = [];
657 for (i = 0; i < noteholder.childNodes.length; i++) {
658 var entry = noteholder.childNodes[i];
Junio C Hamano61525f92014-01-17 22:46:49659 if (entry.nodeName == 'div' && entry.getAttribute("class") == "footnote")
Junio C Hamano9d971152012-12-19 00:43:11660 entriesToRemove.push(entry);
661 }
662 for (i = 0; i < entriesToRemove.length; i++) {
663 noteholder.removeChild(entriesToRemove[i]);
664 }
665
666 // Rebuild footnote entries.
667 var cont = document.getElementById("content");
Junio C Hamano7bd050f2011-09-22 06:32:22668 var spans = cont.getElementsByTagName("span");
669 var refs = {};
670 var n = 0;
671 for (i=0; i<spans.length; i++) {
672 if (spans[i].className == "footnote") {
673 n++;
Junio C Hamano9d971152012-12-19 00:43:11674 var note = spans[i].getAttribute("data-note");
675 if (!note) {
676 // Use [\s\S] in place of . so multi-line matches work.
677 // Because JavaScript has no s (dotall) regex flag.
678 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
679 spans[i].innerHTML =
680 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
681 "' title='View footnote' class='footnote'>" + n + "</a>]";
682 spans[i].setAttribute("data-note", note);
683 }
Junio C Hamano7bd050f2011-09-22 06:32:22684 noteholder.innerHTML +=
685 "<div class='footnote' id='_footnote_" + n + "'>" +
686 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
687 n + "</a>. " + note + "</div>";
Junio C Hamano7bd050f2011-09-22 06:32:22688 var id =spans[i].getAttribute("id");
689 if (id != null) refs["#"+id] = n;
690 }
691 }
692 if (n == 0)
693 noteholder.parentNode.removeChild(noteholder);
694 else {
695 // Process footnoterefs.
696 for (i=0; i<spans.length; i++) {
697 if (spans[i].className == "footnoteref") {
698 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
699 href = href.match(/#.*/)[0]; // Because IE return full URL.
700 n = refs[href];
701 spans[i].innerHTML =
702 "[<a href='#_footnote_" + n +
703 "' title='View footnote' class='footnote'>" + n + "</a>]";
704 }
705 }
706 }
Junio C Hamano9d971152012-12-19 00:43:11707},
708
709install: function(toclevels) {
710 var timerId;
711
712 function reinstall() {
713 asciidoc.footnotes();
714 if (toclevels) {
715 asciidoc.toc(toclevels);
716 }
717 }
718
719 function reinstallAndRemoveTimer() {
720 clearInterval(timerId);
721 reinstall();
722 }
723
724 timerId = setInterval(reinstall, 500);
725 if (document.addEventListener)
726 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
727 else
728 window.onload = reinstallAndRemoveTimer;
Junio C Hamano7bd050f2011-09-22 06:32:22729}
730
731}
Junio C Hamano9d971152012-12-19 00:43:11732asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22733/*]]>*/
734</script>
Junio C Hamano1a4e8412005-12-27 08:17:23735</head>
Junio C Hamano9d971152012-12-19 00:43:11736<body class="manpage">
Junio C Hamano1a4e8412005-12-27 08:17:23737<div id="header">
738<h1>
739git-reset(1) Manual Page
740</h1>
741<h2>NAME</h2>
742<div class="sectionbody">
743<p>git-reset -
Junio C Hamano01078922006-03-10 00:31:47744 Reset current HEAD to the specified state
Junio C Hamano1a4e8412005-12-27 08:17:23745</p>
746</div>
747</div>
Junio C Hamano7bd050f2011-09-22 06:32:22748<div id="content">
Junio C Hamano9d971152012-12-19 00:43:11749<div class="sect1">
Junio C Hamano68cf15a2010-11-06 01:01:59750<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23751<div class="sectionbody">
Junio C Hamanod793de52006-12-26 09:11:43752<div class="verseblock">
Junio C Hamanoe77c5d02013-01-22 19:19:59753<pre class="content"><em>git reset</em> [-q] [&lt;tree-ish&gt;] [--] &lt;paths&gt;&#8230;
Junio C Hamano4e1d0cb2013-07-19 20:43:00754<em>git reset</em> (--patch | -p) [&lt;tree-ish&gt;] [--] [&lt;paths&gt;&#8230;]
Junio C Hamano9d971152012-12-19 00:43:11755<em>git reset</em> [--soft | --mixed | --hard | --merge | --keep] [-q] [&lt;commit&gt;]</pre>
756<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 Hamanoe77c5d02013-01-22 19:19:59763<div class="paragraph"><p>In the first and second form, copy entries from &lt;tree-ish&gt; to the index.
Junio C Hamano657fd8a2010-10-07 00:01:24764In the third form, set the current branch head (HEAD) to &lt;commit&gt;, optionally
Junio C Hamanoe77c5d02013-01-22 19:19:59765modifying index and working tree to match. The &lt;tree-ish&gt;/&lt;commit&gt; defaults
766to HEAD in all forms.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59767<div class="dlist"><dl>
768<dt class="hdlist1">
Junio C Hamanoe77c5d02013-01-22 19:19:59769<em>git reset</em> [-q] [&lt;tree-ish&gt;] [--] &lt;paths&gt;&#8230;
Junio C Hamano1a4e8412005-12-27 08:17:23770</dt>
771<dd>
772<p>
Junio C Hamanob5a296f2010-08-13 02:46:36773 This form resets the index entries for all &lt;paths&gt; to their
Junio C Hamanoe77c5d02013-01-22 19:19:59774 state at &lt;tree-ish&gt;. (It does not affect the working tree, nor
Junio C Hamanob5a296f2010-08-13 02:46:36775 the current branch.)
Junio C Hamano1a4e8412005-12-27 08:17:23776</p>
Junio C Hamano61525f92014-01-17 22:46:49777<div class="paragraph"><p>This means that <tt>git reset &lt;paths&gt;</tt> is the opposite of <tt>git add
778&lt;paths&gt;</tt>.</p></div>
779<div class="paragraph"><p>After running <tt>git reset &lt;paths&gt;</tt> to update the index entry, you can
Junio C Hamanoa28a9202012-06-21 07:08:23780use <a href="git-checkout.html">git-checkout(1)</a> to check the contents out of the index to
Junio C Hamano657fd8a2010-10-07 00:01:24781the working tree.
Junio C Hamanoa28a9202012-06-21 07:08:23782Alternatively, using <a href="git-checkout.html">git-checkout(1)</a> and specifying a commit, you
Junio C Hamano657fd8a2010-10-07 00:01:24783can copy the contents of a path out of a commit to the index and to the
784working tree in one go.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23785</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59786<dt class="hdlist1">
Junio C Hamanoe77c5d02013-01-22 19:19:59787<em>git reset</em> (--patch | -p) [&lt;tree-ish&gt;] [--] [&lt;paths&gt;&#8230;]
Junio C Hamanob5a296f2010-08-13 02:46:36788</dt>
789<dd>
790<p>
791 Interactively select hunks in the difference between the index
Junio C Hamanoe77c5d02013-01-22 19:19:59792 and &lt;tree-ish&gt; (defaults to HEAD). The chosen hunks are applied
Junio C Hamanob5a296f2010-08-13 02:46:36793 in reverse to the index.
794</p>
Junio C Hamano61525f92014-01-17 22:46:49795<div class="paragraph"><p>This means that <tt>git reset -p</tt> is the opposite of <tt>git add -p</tt>, i.e.
Junio C Hamano9d971152012-12-19 00:43:11796you can use it to selectively reset hunks. See the &#8220;Interactive Mode&#8221;
Junio C Hamano61525f92014-01-17 22:46:49797section of <a href="git-add.html">git-add(1)</a> to learn how to operate the <tt>--patch</tt> mode.</p></div>
Junio C Hamanob5a296f2010-08-13 02:46:36798</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59799<dt class="hdlist1">
Junio C Hamanoa1295452012-11-13 22:32:04800<em>git reset</em> [&lt;mode&gt;] [&lt;commit&gt;]
Junio C Hamanob5a296f2010-08-13 02:46:36801</dt>
802<dd>
803<p>
Junio C Hamano657fd8a2010-10-07 00:01:24804 This form resets the current branch head to &lt;commit&gt; and
805 possibly updates the index (resetting it to the tree of &lt;commit&gt;) and
Junio C Hamanoa1295452012-11-13 22:32:04806 the working tree depending on &lt;mode&gt;. If &lt;mode&gt; is omitted,
807 defaults to "--mixed". The &lt;mode&gt; must be one of the following:
Junio C Hamanob5a296f2010-08-13 02:46:36808</p>
Junio C Hamano9d971152012-12-19 00:43:11809<div class="openblock">
810<div class="content">
Junio C Hamano68cf15a2010-11-06 01:01:59811<div class="dlist"><dl>
812<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23813--soft
814</dt>
815<dd>
816<p>
Junio C Hamano657fd8a2010-10-07 00:01:24817 Does not touch the index file nor the working tree at all (but
818 resets the head to &lt;commit&gt;, just like all modes do). This leaves
819 all your changed files "Changes to be committed", as <em>git status</em>
820 would put it.
Junio C Hamano1a4e8412005-12-27 08:17:23821</p>
822</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59823<dt class="hdlist1">
Junio C Hamanob5a296f2010-08-13 02:46:36824--mixed
825</dt>
826<dd>
827<p>
828 Resets the index but not the working tree (i.e., the changed files
829 are preserved but not marked for commit) and reports what has not
830 been updated. This is the default action.
831</p>
832</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59833<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23834--hard
835</dt>
836<dd>
837<p>
Junio C Hamano657fd8a2010-10-07 00:01:24838 Resets the index and working tree. Any changes to tracked files in the
839 working tree since &lt;commit&gt; are discarded.
Junio C Hamano1a4e8412005-12-27 08:17:23840</p>
841</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59842<dt class="hdlist1">
Junio C Hamanobbbb8652008-12-29 10:34:22843--merge
844</dt>
845<dd>
846<p>
Junio C Hamano657fd8a2010-10-07 00:01:24847 Resets the index and updates the files in the working tree that are
848 different between &lt;commit&gt; 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 &lt;commit&gt; and the index has unstaged
Junio C Hamano68cf15a2010-11-06 01:01:59852 changes, reset is aborted.
Junio C Hamanobbbb8652008-12-29 10:34:22853</p>
Junio C Hamano68cf15a2010-11-06 01:01:59854<div class="paragraph"><p>In other words, --merge does something like a <em>git read-tree -u -m &lt;commit&gt;</em>,
855but carries forward unmerged index entries.</p></div>
Junio C Hamanobbbb8652008-12-29 10:34:22856</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59857<dt class="hdlist1">
Junio C Hamano0299d922010-03-20 20:59:31858--keep
859</dt>
860<dd>
861<p>
Junio C Hamano20338b42011-01-22 00:51:59862 Resets index entries and updates files in the working tree that are
863 different between &lt;commit&gt; and HEAD.
Junio C Hamano657fd8a2010-10-07 00:01:24864 If a file that is different between &lt;commit&gt; and HEAD has local changes,
Junio C Hamano68cf15a2010-11-06 01:01:59865 reset is aborted.
Junio C Hamano0299d922010-03-20 20:59:31866</p>
867</dd>
Junio C Hamanob5a296f2010-08-13 02:46:36868</dl></div>
Junio C Hamano9d971152012-12-19 00:43:11869</div></div>
Junio C Hamanoc28068f2009-09-08 00:55:23870</dd>
Junio C Hamanob5a296f2010-08-13 02:46:36871</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:59872<div class="paragraph"><p>If you want to undo a commit other than the latest on a branch,
Junio C Hamanoa28a9202012-06-21 07:08:23873<a href="git-revert.html">git-revert(1)</a> is your friend.</p></div>
Junio C Hamanob5a296f2010-08-13 02:46:36874</div>
Junio C Hamano9d971152012-12-19 00:43:11875</div>
876<div class="sect1">
Junio C Hamanob5a296f2010-08-13 02:46:36877<h2 id="_options">OPTIONS</h2>
878<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59879<div class="dlist"><dl>
880<dt class="hdlist1">
Junio C Hamano422cfec2007-11-08 08:07:45881-q
882</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59883<dt class="hdlist1">
Junio C Hamanob141a922010-01-10 19:55:14884--quiet
885</dt>
Junio C Hamano422cfec2007-11-08 08:07:45886<dd>
887<p>
888 Be quiet, only report errors.
889</p>
890</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31891</dl></div>
Junio C Hamano1bb569e2006-05-05 23:14:25892</div>
Junio C Hamano9d971152012-12-19 00:43:11893</div>
894<div class="sect1">
Junio C Hamanob5a296f2010-08-13 02:46:36895<h2 id="_examples">EXAMPLES</h2>
Junio C Hamano1bb569e2006-05-05 23:14:25896<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:59897<div class="dlist"><dl>
898<dt class="hdlist1">
Junio C Hamano89d4e0f2007-02-18 00:34:59899Undo add
Junio C Hamano1a4e8412005-12-27 08:17:23900</dt>
901<dd>
902<div class="listingblock">
903<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49904<pre><tt>$ edit <b>&lt;1&gt;</b>
Junio C Hamano89d4e0f2007-02-18 00:34:59905$ git add frotz.c filfre.c
Junio C Hamano68cf15a2010-11-06 01:01:59906$ mailx <b>&lt;2&gt;</b>
907$ git reset <b>&lt;3&gt;</b>
Junio C Hamano61525f92014-01-17 22:46:49908$ git pull git://info.example.com/ nitfol <b>&lt;4&gt;</b></tt></pre>
Junio C Hamanoc8d88c22006-04-29 07:02:01909</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59910<div class="colist arabic"><ol>
Junio C Hamanoc8d88c22006-04-29 07:02:01911<li>
912<p>
Junio C Hamano092f5f02007-08-02 07:23:38913You are happily working on something, and find the changes
Junio C Hamano1a4e8412005-12-27 08:17:23914in these files are in good order. You do not want to see them
915when you run "git diff", because you plan to work on other files
916and changes with these files are distracting.
Junio C Hamanoc8d88c22006-04-29 07:02:01917</p>
918</li>
919<li>
920<p>
Junio C Hamano092f5f02007-08-02 07:23:38921Somebody asks you to pull, and the changes sounds worthy of merging.
Junio C Hamanoc8d88c22006-04-29 07:02:01922</p>
923</li>
924<li>
925<p>
Junio C Hamano092f5f02007-08-02 07:23:38926However, you already dirtied the index (i.e. your index does
Junio C Hamano1a4e8412005-12-27 08:17:23927not match the HEAD commit). But you know the pull you are going
928to make does not affect frotz.c nor filfre.c, so you revert the
929index changes for these two files. Your changes in working tree
930remain there.
Junio C Hamanoc8d88c22006-04-29 07:02:01931</p>
932</li>
933<li>
934<p>
Junio C Hamano092f5f02007-08-02 07:23:38935Then you can pull and merge, leaving frotz.c and filfre.c
Junio C Hamanoc8d88c22006-04-29 07:02:01936changes still in the working tree.
937</p>
938</li>
Junio C Hamanoba4b9282008-07-06 05:20:31939</ol></div>
Junio C Hamano1a4e8412005-12-27 08:17:23940</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59941<dt class="hdlist1">
Junio C Hamanob5a296f2010-08-13 02:46:36942Undo a commit and redo
943</dt>
944<dd>
945<div class="listingblock">
946<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49947<pre><tt>$ git commit ...
Junio C Hamano68cf15a2010-11-06 01:01:59948$ git reset --soft HEAD^ <b>&lt;1&gt;</b>
949$ edit <b>&lt;2&gt;</b>
Junio C Hamano61525f92014-01-17 22:46:49950$ git commit -a -c ORIG_HEAD <b>&lt;3&gt;</b></tt></pre>
Junio C Hamanob5a296f2010-08-13 02:46:36951</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59952<div class="colist arabic"><ol>
Junio C Hamanob5a296f2010-08-13 02:46:36953<li>
954<p>
955This is most often done when you remembered what you
956just committed is incomplete, or you misspelled your commit
957message, or both. Leaves working tree as it was before "reset".
958</p>
959</li>
960<li>
961<p>
962Make 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
968commit by starting with its log message. If you do not need to
969edit the message further, you can give -C option instead.
970</p>
Junio C Hamanoa28a9202012-06-21 07:08:23971<div class="paragraph"><p>See also the --amend option to <a href="git-commit.html">git-commit(1)</a>.</p></div>
Junio C Hamanob5a296f2010-08-13 02:46:36972</li>
973</ol></div>
974</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59975<dt class="hdlist1">
Junio C Hamanob5a296f2010-08-13 02:46:36976Undo a commit, making it a topic branch
977</dt>
978<dd>
979<div class="listingblock">
980<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49981<pre><tt>$ git branch topic/wip <b>&lt;1&gt;</b>
Junio C Hamano68cf15a2010-11-06 01:01:59982$ git reset --hard HEAD~3 <b>&lt;2&gt;</b>
Junio C Hamano61525f92014-01-17 22:46:49983$ git checkout topic/wip <b>&lt;3&gt;</b></tt></pre>
Junio C Hamanob5a296f2010-08-13 02:46:36984</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:59985<div class="colist arabic"><ol>
Junio C Hamanob5a296f2010-08-13 02:46:36986<li>
987<p>
988You have made some commits, but realize they were premature
989to be in the "master" branch. You want to continue polishing
990them in a topic branch, so create "topic/wip" branch off of the
991current HEAD.
992</p>
993</li>
994<li>
995<p>
996Rewind the master branch to get rid of those three commits.
997</p>
998</li>
999<li>
1000<p>
1001Switch to "topic/wip" branch and keep working.
1002</p>
1003</li>
1004</ol></div>
1005</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591006<dt class="hdlist1">
Junio C Hamanob5a296f2010-08-13 02:46:361007Undo commits permanently
1008</dt>
1009<dd>
1010<div class="listingblock">
1011<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491012<pre><tt>$ git commit ...
1013$ git reset --hard HEAD~3 <b>&lt;1&gt;</b></tt></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361014</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591015<div class="colist arabic"><ol>
Junio C Hamanob5a296f2010-08-13 02:46:361016<li>
1017<p>
1018The last three commits (HEAD, HEAD^, and HEAD~2) were bad
1019and you do not want to ever see them again. Do <strong>not</strong> do this if
1020you have already given these commits to somebody else. (See the
Junio C Hamanoa28a9202012-06-21 07:08:231021"RECOVERING FROM UPSTREAM REBASE" section in <a href="git-rebase.html">git-rebase(1)</a> for
Junio C Hamanob5a296f2010-08-13 02:46:361022the implications of doing so.)
1023</p>
1024</li>
1025</ol></div>
1026</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591027<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231028Undo a merge or pull
1029</dt>
1030<dd>
1031<div class="listingblock">
1032<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491033<pre><tt>$ git pull <b>&lt;1&gt;</b>
Junio C Hamano1a4e8412005-12-27 08:17:231034Auto-merging nitfol
1035CONFLICT (content): Merge conflict in nitfol
Junio C Hamano6a3c8272008-12-19 21:38:181036Automatic merge failed; fix conflicts and then commit the result.
Junio C Hamano68cf15a2010-11-06 01:01:591037$ git reset --hard <b>&lt;2&gt;</b>
1038$ git pull . topic/branch <b>&lt;3&gt;</b>
Junio C Hamano1a4e8412005-12-27 08:17:231039Updating from 41223... to 13134...
Junio C Hamano3f680f32009-11-16 02:10:541040Fast-forward
Junio C Hamano61525f92014-01-17 22:46:491041$ git reset --hard ORIG_HEAD <b>&lt;4&gt;</b></tt></pre>
Junio C Hamanoc8d88c22006-04-29 07:02:011042</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591043<div class="colist arabic"><ol>
Junio C Hamanoc8d88c22006-04-29 07:02:011044<li>
1045<p>
Junio C Hamano092f5f02007-08-02 07:23:381046Try to update from the upstream resulted in a lot of
Junio C Hamanoc8d88c22006-04-29 07:02:011047conflicts; you were not ready to spend a lot of time merging
1048right 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"
1054which is a synonym for "git reset --hard HEAD" clears the mess
1055from the index file and the working tree.
1056</p>
1057</li>
1058<li>
1059<p>
Junio C Hamano092f5f02007-08-02 07:23:381060Merge a topic branch into the current branch, which resulted
Junio C Hamano3f680f32009-11-16 02:10:541061in a fast-forward.
Junio C Hamanoc8d88c22006-04-29 07:02:011062</p>
1063</li>
1064<li>
1065<p>
Junio C Hamano092f5f02007-08-02 07:23:381066But you decided that the topic branch is not ready for public
Junio C Hamano1a4e8412005-12-27 08:17:231067consumption yet. "pull" or "merge" always leaves the original
1068tip of the current branch in ORIG_HEAD, so resetting hard to it
1069brings your index file and the working tree back to that state,
Junio C Hamanoc8d88c22006-04-29 07:02:011070and resets the tip of the branch to that commit.
1071</p>
1072</li>
Junio C Hamanoba4b9282008-07-06 05:20:311073</ol></div>
Junio C Hamano1a4e8412005-12-27 08:17:231074</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591075<dt class="hdlist1">
Junio C Hamano657fd8a2010-10-07 00:01:241076Undo a merge or pull inside a dirty working tree
Junio C Hamanobbbb8652008-12-29 10:34:221077</dt>
1078<dd>
1079<div class="listingblock">
1080<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491081<pre><tt>$ git pull <b>&lt;1&gt;</b>
Junio C Hamanobbbb8652008-12-29 10:34:221082Auto-merging nitfol
1083Merge made by recursive.
1084 nitfol | 20 +++++----
1085 ...
Junio C Hamano61525f92014-01-17 22:46:491086$ git reset --merge ORIG_HEAD <b>&lt;2&gt;</b></tt></pre>
Junio C Hamanobbbb8652008-12-29 10:34:221087</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591088<div class="colist arabic"><ol>
Junio C Hamanobbbb8652008-12-29 10:34:221089<li>
1090<p>
1091Even if you may have local modifications in your
1092working tree, you can safely say "git pull" when you know
1093that the change in the other branch does not overlap with
1094them.
1095</p>
1096</li>
1097<li>
1098<p>
1099After inspecting the result of the merge, you may find
1100that the change in the other branch is unsatisfactory. Running
1101"git reset --hard ORIG_HEAD" will let you go back to where you
1102were, but it will discard your local changes, which you do not
1103want. "git reset --merge" keeps your local changes.
1104</p>
1105</li>
1106</ol></div>
1107</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591108<dt class="hdlist1">
Junio C Hamano74e8a2d2006-01-14 03:58:411109Interrupted workflow
1110</dt>
1111<dd>
Junio C Hamano68cf15a2010-11-06 01:01:591112<div class="paragraph"><p>Suppose you are interrupted by an urgent fix request while you
Junio C Hamanoa6331a82006-01-22 07:50:331113are in the middle of a large change. The files in your
Junio C Hamano74e8a2d2006-01-14 03:58:411114working tree are not in any shape to be committed yet, but you
Junio C Hamanoba4b9282008-07-06 05:20:311115need to get to the other branch for a quick bugfix.</p></div>
Junio C Hamano74e8a2d2006-01-14 03:58:411116<div class="listingblock">
1117<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491118<pre><tt>$ git checkout feature ;# you were working in "feature" branch and
Junio C Hamano74e8a2d2006-01-14 03:58:411119$ work work work ;# got interrupted
Junio C Hamano68cf15a2010-11-06 01:01:591120$ git commit -a -m "snapshot WIP" <b>&lt;1&gt;</b>
Junio C Hamano74e8a2d2006-01-14 03:58:411121$ git checkout master
1122$ fix fix fix
1123$ git commit ;# commit with real log
1124$ git checkout feature
Junio C Hamano68cf15a2010-11-06 01:01:591125$ git reset --soft HEAD^ ;# go back to WIP state <b>&lt;2&gt;</b>
Junio C Hamano61525f92014-01-17 22:46:491126$ git reset <b>&lt;3&gt;</b></tt></pre>
Junio C Hamano74e8a2d2006-01-14 03:58:411127</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591128<div class="colist arabic"><ol>
Junio C Hamanoc8d88c22006-04-29 07:02:011129<li>
1130<p>
1131This commit will get blown away so a throw-away log message is OK.
1132</p>
1133</li>
1134<li>
1135<p>
1136This 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>
1142At 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 Hamanoa28a9202012-06-21 07:08:231146<div class="paragraph"><p>See also <a href="git-stash.html">git-stash(1)</a>.</p></div>
Junio C Hamanoc8d88c22006-04-29 07:02:011147</li>
Junio C Hamanoba4b9282008-07-06 05:20:311148</ol></div>
Junio C Hamano74e8a2d2006-01-14 03:58:411149</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591150<dt class="hdlist1">
Junio C Hamano26e590a2008-02-17 03:53:511151Reset a single file in the index
1152</dt>
1153<dd>
Junio C Hamano68cf15a2010-11-06 01:01:591154<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:511155want to add it to your commit. You can remove the file from the index
Junio C Hamanoba4b9282008-07-06 05:20:311156while keeping your changes with git reset.</p></div>
Junio C Hamano26e590a2008-02-17 03:53:511157<div class="listingblock">
1158<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491159<pre><tt>$ git reset -- frotz.c <b>&lt;1&gt;</b>
Junio C Hamano68cf15a2010-11-06 01:01:591160$ git commit -m "Commit files in index" <b>&lt;2&gt;</b>
Junio C Hamano61525f92014-01-17 22:46:491161$ git add frotz.c <b>&lt;3&gt;</b></tt></pre>
Junio C Hamano26e590a2008-02-17 03:53:511162</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591163<div class="colist arabic"><ol>
Junio C Hamano26e590a2008-02-17 03:53:511164<li>
1165<p>
1166This removes the file from the index while keeping it in the working
1167 directory.
1168</p>
1169</li>
1170<li>
1171<p>
1172This commits all other changes in the index.
1173</p>
1174</li>
1175<li>
1176<p>
1177Adds the file to the index again.
1178</p>
1179</li>
Junio C Hamanoba4b9282008-07-06 05:20:311180</ol></div>
Junio C Hamano26e590a2008-02-17 03:53:511181</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591182<dt class="hdlist1">
Junio C Hamano0299d922010-03-20 20:59:311183Keep changes in working tree while discarding some previous commits
1184</dt>
1185<dd>
Junio C Hamano68cf15a2010-11-06 01:01:591186<div class="paragraph"><p>Suppose you are working on something and you commit it, and then you
Junio C Hamano0299d922010-03-20 20:59:311187continue working a bit more, but now you think that what you have in
1188your working tree should be in another branch that has nothing to do
Junio C Hamano619596a2010-08-18 22:15:351189with what you committed previously. You can start a new branch and
Junio C Hamano657fd8a2010-10-07 00:01:241190reset it while keeping the changes in your working tree.</p></div>
Junio C Hamano0299d922010-03-20 20:59:311191<div class="listingblock">
1192<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491193<pre><tt>$ git tag start
Junio C Hamano0299d922010-03-20 20:59:311194$ git checkout -b branch1
1195$ edit
Junio C Hamano68cf15a2010-11-06 01:01:591196$ git commit ... <b>&lt;1&gt;</b>
Junio C Hamano0299d922010-03-20 20:59:311197$ edit
Junio C Hamano68cf15a2010-11-06 01:01:591198$ git checkout -b branch2 <b>&lt;2&gt;</b>
Junio C Hamano61525f92014-01-17 22:46:491199$ git reset --keep start <b>&lt;3&gt;</b></tt></pre>
Junio C Hamano0299d922010-03-20 20:59:311200</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591201<div class="colist arabic"><ol>
Junio C Hamano0299d922010-03-20 20:59:311202<li>
1203<p>
1204This commits your first edits in branch1.
1205</p>
1206</li>
1207<li>
1208<p>
1209In 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>
1217But 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 Hamanoba4b9282008-07-06 05:20:311223</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231224</div>
Junio C Hamano9d971152012-12-19 00:43:111225</div>
1226<div class="sect1">
Junio C Hamanob5a296f2010-08-13 02:46:361227<h2 id="_discussion">DISCUSSION</h2>
1228<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591229<div class="paragraph"><p>The tables below show what happens when running:</p></div>
Junio C Hamanob5a296f2010-08-13 02:46:361230<div class="listingblock">
1231<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491232<pre><tt>git reset --option target</tt></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361233</div></div>
Junio C Hamano61525f92014-01-17 22:46:491234<div class="paragraph"><p>to reset the HEAD to another commit (<tt>target</tt>) with the different
Junio C Hamanob5a296f2010-08-13 02:46:361235reset options depending on the state of the files.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591236<div class="paragraph"><p>In these tables, A, B, C and D are some different states of a
Junio C Hamanob5a296f2010-08-13 02:46:361237file. For example, the first line of the first table means that if a
1238file is in state A in the working tree, in state B in the index, in
1239state C in HEAD and in state D in the target, then "git reset --soft
Junio C Hamano657fd8a2010-10-07 00:01:241240target" will leave the file in the working tree in state A and in the
1241index in state B. It resets (i.e. moves) the HEAD (i.e. the tip of
1242the current branch, if you are on one) to "target" (which has the file
1243in state D).</p></div>
Junio C Hamanob5a296f2010-08-13 02:46:361244<div class="literalblock">
1245<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491246<pre><tt>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361247----------------------------------------------------
1248 A B C D --soft A B D
1249 --mixed A D D
1250 --hard D D D
1251 --merge (disallowed)
Junio C Hamano61525f92014-01-17 22:46:491252 --keep (disallowed)</tt></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361253</div></div>
1254<div class="literalblock">
1255<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491256<pre><tt>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361257----------------------------------------------------
1258 A B C C --soft A B C
1259 --mixed A C C
1260 --hard C C C
1261 --merge (disallowed)
Junio C Hamano61525f92014-01-17 22:46:491262 --keep A C C</tt></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361263</div></div>
1264<div class="literalblock">
1265<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491266<pre><tt>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361267----------------------------------------------------
1268 B B C D --soft B B D
1269 --mixed B D D
1270 --hard D D D
1271 --merge D D D
Junio C Hamano61525f92014-01-17 22:46:491272 --keep (disallowed)</tt></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361273</div></div>
1274<div class="literalblock">
1275<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491276<pre><tt>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361277----------------------------------------------------
1278 B B C C --soft B B C
1279 --mixed B C C
1280 --hard C C C
1281 --merge C C C
Junio C Hamano61525f92014-01-17 22:46:491282 --keep B C C</tt></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361283</div></div>
1284<div class="literalblock">
1285<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491286<pre><tt>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361287----------------------------------------------------
1288 B C C D --soft B C D
1289 --mixed B D D
1290 --hard D D D
1291 --merge (disallowed)
Junio C Hamano61525f92014-01-17 22:46:491292 --keep (disallowed)</tt></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361293</div></div>
1294<div class="literalblock">
1295<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491296<pre><tt>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361297----------------------------------------------------
1298 B C C C --soft B C C
1299 --mixed B C C
1300 --hard C C C
1301 --merge B C C
Junio C Hamano61525f92014-01-17 22:46:491302 --keep B C C</tt></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361303</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591304<div class="paragraph"><p>"reset --merge" is meant to be used when resetting out of a conflicted
Junio C Hamano657fd8a2010-10-07 00:01:241305merge. Any mergy operation guarantees that the working tree file that is
Junio C Hamanob5a296f2010-08-13 02:46:361306involved in the merge does not have local change wrt the index before
Junio C Hamano657fd8a2010-10-07 00:01:241307it starts, and that it writes the result out to the working tree. So if
Junio C Hamanob5a296f2010-08-13 02:46:361308we see some difference between the index and the target and also
Junio C Hamano657fd8a2010-10-07 00:01:241309between the index and the working tree, then it means that we are not
Junio C Hamanob5a296f2010-08-13 02:46:361310resetting out from a state that a mergy operation left after failing
1311with a conflict. That is why we disallow --merge option in this case.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591312<div class="paragraph"><p>"reset --keep" is meant to be used when removing some of the last
Junio C Hamanob5a296f2010-08-13 02:46:361313commits in the current branch while keeping changes in the working
1314tree. If there could be conflicts between the changes in the commit we
1315want to remove and the changes in the working tree we want to keep,
Junio C Hamano68cf15a2010-11-06 01:01:591316the reset is disallowed. That&#8217;s why it is disallowed if there are both
Junio C Hamanob5a296f2010-08-13 02:46:361317changes between the working tree and HEAD, and between HEAD and the
1318target. To be safe, it is also disallowed when there are unmerged
1319entries.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591320<div class="paragraph"><p>The following tables show what happens when there are unmerged
Junio C Hamanob5a296f2010-08-13 02:46:361321entries:</p></div>
1322<div class="literalblock">
1323<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491324<pre><tt>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361325----------------------------------------------------
1326 X U A B --soft (disallowed)
1327 --mixed X B B
1328 --hard B B B
1329 --merge B B B
Junio C Hamano61525f92014-01-17 22:46:491330 --keep (disallowed)</tt></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361331</div></div>
1332<div class="literalblock">
1333<div class="content">
Junio C Hamano61525f92014-01-17 22:46:491334<pre><tt>working index HEAD target working index HEAD
Junio C Hamanob5a296f2010-08-13 02:46:361335----------------------------------------------------
1336 X U A A --soft (disallowed)
1337 --mixed X A A
1338 --hard A A A
1339 --merge A A A
Junio C Hamano61525f92014-01-17 22:46:491340 --keep (disallowed)</tt></pre>
Junio C Hamanob5a296f2010-08-13 02:46:361341</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591342<div class="paragraph"><p>X means any state and U means an unmerged index.</p></div>
Junio C Hamanob5a296f2010-08-13 02:46:361343</div>
Junio C Hamano9d971152012-12-19 00:43:111344</div>
1345<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311346<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231347<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231348<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231349</div>
Junio C Hamano7bd050f2011-09-22 06:32:221350</div>
Junio C Hamano9d971152012-12-19 00:43:111351</div>
Junio C Hamano7bd050f2011-09-22 06:32:221352<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:231353<div id="footer">
1354<div id="footer-text">
Junio C Hamano683a8612013-08-23 20:50:091355Last updated 2013-08-20 08:40:27 PDT
Junio C Hamano1a4e8412005-12-27 08:17:231356</div>
1357</div>
1358</body>
1359</html>