blob: 7f6dc08a7129952ca86b0dcbe42e1494c5093ce5 [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 Hamanof2b74942012-11-20 21:06:267<title>How to revert an existing commit</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 Hamano0868a302008-07-22 09:20:4430a {
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 Hamano103b5722011-01-31 05:03:4540 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2341}
42
43strong {
44 font-weight: bold;
Junio C Hamano103b5722011-01-31 05:03:4545 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 Hamano0868a302008-07-22 09:20:4455h1, 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 Hamano0868a302008-07-22 09:20:4461h3 {
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 Hamano103b5722011-01-31 05:03:4584ul, 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 Hamano103b5722011-01-31 05:03:4589
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 Hamano0868a302008-07-22 09:20:4498 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 Hamano103b5722011-01-31 05:03:45121 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 Hamano103b5722011-01-31 05:03:45143 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 Hamano103b5722011-01-31 05:03:45180 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 Hamano103b5722011-01-31 05:03:45185div.quoteblock > div.attribution {
186 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23187 text-align: right;
188}
Junio C Hamano103b5722011-01-31 05:03:45189
Junio C Hamano9d971152012-12-19 00:43:11190div.verseblock > pre.content {
191 font-family: inherit;
192 font-size: inherit;
Junio C Hamano103b5722011-01-31 05:03:45193}
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 Hamano0868a302008-07-22 09:20:44199div.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 Hamano103b5722011-01-31 05:03:45223a.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 Hamano103b5722011-01-31 05:03:45232 font-style: normal;
233 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23234}
235dd > *:first-child {
Junio C Hamano103b5722011-01-31 05:03:45236 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23237}
238
239ul, ol {
240 list-style-position: outside;
241}
Junio C Hamano103b5722011-01-31 05:03:45242ol.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 Hamano103b5722011-01-31 05:03:45248ol.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 Hamano103b5722011-01-31 05:03:45268td > div.verse {
269 white-space: pre;
270}
Junio C Hamano103b5722011-01-31 05:03:45271
272div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23273 margin-top: 0.8em;
274 margin-bottom: 0.8em;
275}
Junio C Hamano103b5722011-01-31 05:03:45276div.hdlist tr {
277 padding-bottom: 15px;
Junio C Hamano0868a302008-07-22 09:20:44278}
Junio C Hamano103b5722011-01-31 05:03:45279dt.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 Hamano103b5722011-01-31 05:03:45284 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23285 padding-right: 0.8em;
Junio C Hamano103b5722011-01-31 05:03:45286 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23287}
Junio C Hamano103b5722011-01-31 05:03:45288td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23289 vertical-align: top;
290}
Junio C Hamano103b5722011-01-31 05:03:45291div.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 Hamano0868a302008-07-22 09:20:44335
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 Hamano0868a302008-07-22 09:20:44345 color: #527bbd;
Junio C Hamano0868a302008-07-22 09:20:44346 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 Hamano0868a302008-07-22 09:20:44353 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 Hamano1a4e8412005-12-27 08:17:23368
Junio C Hamano9d971152012-12-19 00:43:11369span.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;
Junio C Hamano1a4e8412005-12-27 08:17:23425}
Junio C Hamano9d971152012-12-19 00:43:11426div.tableblock > table {
427 border: 3px solid #527bbd;
428}
429thead, p.table.header {
Junio C Hamano1a4e8412005-12-27 08:17:23430 font-weight: bold;
Junio C Hamano9d971152012-12-19 00:43:11431 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;
Junio C Hamano1a4e8412005-12-27 08:17:23447}
448
Junio C Hamano9d971152012-12-19 00:43:11449
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;
Junio C Hamano1a4e8412005-12-27 08:17:23484}
485
Junio C Hamano9d971152012-12-19 00:43:11486table.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 {
Junio C Hamano103b5722011-01-31 05:03:45505 text-align: right;
506}
507
Junio C Hamano9d971152012-12-19 00:43:11508th.tableblock.valign-top, td.tableblock.valign-top {
509 vertical-align: top;
Junio C Hamano103b5722011-01-31 05:03:45510}
Junio C Hamano9d971152012-12-19 00:43:11511th.tableblock.valign-middle, td.tableblock.valign-middle {
512 vertical-align: middle;
513}
514th.tableblock.valign-bottom, td.tableblock.valign-bottom {
515 vertical-align: bottom;
Junio C Hamano1a4e8412005-12-27 08:17:23516}
517
Junio C Hamano9d971152012-12-19 00:43:11518
519/*
520 * manpage specific
521 *
522 * */
523
524body.manpage h1 {
525 padding-top: 0.5em;
526 padding-bottom: 0.5em;
527 border-top: 2px solid silver;
528 border-bottom: 2px solid silver;
529}
530body.manpage h2 {
531 border-style: none;
532}
533body.manpage div.sectionbody {
534 margin-left: 3em;
Junio C Hamano1a4e8412005-12-27 08:17:23535}
Junio C Hamano0868a302008-07-22 09:20:44536
Junio C Hamano9d971152012-12-19 00:43:11537@media print {
538 body.manpage div#toc { display: none; }
539}
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="article">
Junio C Hamano1a4e8412005-12-27 08:17:23737<div id="header">
Junio C Hamanof2b74942012-11-20 21:06:26738<h1>How to revert an existing commit</h1>
Junio C Hamano1a4e8412005-12-27 08:17:23739</div>
Junio C Hamano7bd050f2011-09-22 06:32:22740<div id="content">
Junio C Hamanod97409f2006-10-03 08:41:56741<div id="preamble">
742<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45743<div class="paragraph"><p>One of the changes I pulled into the <em>master</em> branch turns out to
Junio C Hamanod7fccbf2013-07-25 03:24:57744break building Git with GCC 2.95. While they were well-intentioned
Junio C Hamanod97409f2006-10-03 08:41:56745portability fixes, keeping things working with gcc-2.95 was also
746important. Here is what I did to revert the change in the <em>master</em>
Junio C Hamano076ffcc2013-02-06 05:13:21747branch and to adjust the <em>pu</em> branch, using core Git tools and
Junio C Hamano0868a302008-07-22 09:20:44748barebone Porcelain.</p></div>
Junio C Hamano103b5722011-01-31 05:03:45749<div class="paragraph"><p>First, prepare a throw-away branch in case I screw things up.</p></div>
Junio C Hamanod97409f2006-10-03 08:41:56750<div class="listingblock">
751<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49752<pre><tt>$ git checkout -b revert-c99 master</tt></pre>
Junio C Hamanod97409f2006-10-03 08:41:56753</div></div>
Junio C Hamano103b5722011-01-31 05:03:45754<div class="paragraph"><p>Now I am on the <em>revert-c99</em> branch. Let&#8217;s figure out which commit to
Junio C Hamanod97409f2006-10-03 08:41:56755revert. I happen to know that the top of the <em>master</em> branch is a
756merge, and its second parent (i.e. foreign commit I merged from) has
757the change I would want to undo. Further I happen to know that that
Junio C Hamano0868a302008-07-22 09:20:44758merge introduced 5 commits or so:</p></div>
Junio C Hamanod97409f2006-10-03 08:41:56759<div class="listingblock">
760<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49761<pre><tt>$ git show-branch --more=4 master master^2 | head
Junio C Hamanod97409f2006-10-03 08:41:56762* [master] Merge refs/heads/portable from http://www.cs.berkeley....
763 ! [master^2] Replace C99 array initializers with code.
764--
765- [master] Merge refs/heads/portable from http://www.cs.berkeley....
766*+ [master^2] Replace C99 array initializers with code.
767*+ [master^2~1] Replace unsetenv() and setenv() with older putenv().
768*+ [master^2~2] Include sys/time.h in daemon.c.
769*+ [master^2~3] Fix ?: statements.
770*+ [master^2~4] Replace zero-length array decls with [].
Junio C Hamano61525f92014-01-17 22:46:49771* [master~1] tutorial note about git branch</tt></pre>
Junio C Hamanod97409f2006-10-03 08:41:56772</div></div>
Junio C Hamano103b5722011-01-31 05:03:45773<div class="paragraph"><p>The <em>--more=4</em> above means "after we reach the merge base of refs,
Junio C Hamanod97409f2006-10-03 08:41:56774show until we display four more common commits". That last commit
775would have been where the "portable" branch was forked from the main
776git.git repository, so this would show everything on both branches
777since then. I just limited the output to the first handful using
Junio C Hamano0868a302008-07-22 09:20:44778<em>head</em>.</p></div>
Junio C Hamano103b5722011-01-31 05:03:45779<div class="paragraph"><p>Now I know <em>master^2~4</em> (pronounce it as "find the second parent of
Junio C Hamanod97409f2006-10-03 08:41:56780the <em>master</em>, and then go four generations back following the first
781parent") is the one I would want to revert. Since I also want to say
782why I am reverting it, the <em>-n</em> flag is given to <em>git revert</em>. This
783prevents it from actually making a commit, and instead <em>git revert</em>
Junio C Hamano0868a302008-07-22 09:20:44784leaves the commit log message it wanted to use in <em>.msg</em> file:</p></div>
Junio C Hamanod97409f2006-10-03 08:41:56785<div class="listingblock">
786<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49787<pre><tt>$ git revert -n master^2~4
Junio C Hamanod97409f2006-10-03 08:41:56788$ cat .msg
789Revert "Replace zero-length array decls with []."
790
791This reverts 6c5f9baa3bc0d63e141e0afc23110205379905a4 commit.
792$ git diff HEAD ;# to make sure what we are reverting makes sense.
793$ make CC=gcc-2.95 clean test ;# make sure it fixed the breakage.
Junio C Hamano61525f92014-01-17 22:46:49794$ make clean test ;# make sure it did not cause other breakage.</tt></pre>
Junio C Hamanod97409f2006-10-03 08:41:56795</div></div>
Junio C Hamano103b5722011-01-31 05:03:45796<div class="paragraph"><p>The reverted change makes sense (from reading the <em>diff</em> output), does
Junio C Hamanod97409f2006-10-03 08:41:56797fix the problem (from <em>make CC=gcc-2.95</em> test), and does not cause new
Junio C Hamano103b5722011-01-31 05:03:45798breakage (from the last <em>make test</em>). I&#8217;m ready to commit:</p></div>
Junio C Hamanod97409f2006-10-03 08:41:56799<div class="listingblock">
800<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49801<pre><tt>$ git commit -a -s ;# read .msg into the log,
802 # and explain why I am reverting.</tt></pre>
Junio C Hamanod97409f2006-10-03 08:41:56803</div></div>
Junio C Hamano103b5722011-01-31 05:03:45804<div class="paragraph"><p>I could have screwed up in any of the above steps, but in the worst
Junio C Hamanod97409f2006-10-03 08:41:56805case I could just have done <em>git checkout master</em> to start over.
806Fortunately I did not have to; what I have in the current branch
Junio C Hamano0868a302008-07-22 09:20:44807<em>revert-c99</em> is what I want. So merge that back into <em>master</em>:</p></div>
Junio C Hamanod97409f2006-10-03 08:41:56808<div class="listingblock">
809<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49810<pre><tt>$ git checkout master
Junio C Hamano3f680f32009-11-16 02:10:54811$ git merge revert-c99 ;# this should be a fast-forward
Junio C Hamanod97409f2006-10-03 08:41:56812Updating from 10d781b9caa4f71495c7b34963bef137216f86a8 to e3a693c...
813 cache.h | 8 ++++----
814 commit.c | 2 +-
815 ls-files.c | 2 +-
816 receive-pack.c | 2 +-
817 server-info.c | 2 +-
Junio C Hamano61525f92014-01-17 22:46:49818 5 files changed, 8 insertions(+), 8 deletions(-)</tt></pre>
Junio C Hamanod97409f2006-10-03 08:41:56819</div></div>
Junio C Hamano103b5722011-01-31 05:03:45820<div class="paragraph"><p>There is no need to redo the test at this point. We fast-forwarded
Junio C Hamano0868a302008-07-22 09:20:44821and we know <em>master</em> matches <em>revert-c99</em> exactly. In fact:</p></div>
Junio C Hamanod97409f2006-10-03 08:41:56822<div class="listingblock">
823<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49824<pre><tt>$ git diff master..revert-c99</tt></pre>
Junio C Hamanod97409f2006-10-03 08:41:56825</div></div>
Junio C Hamano103b5722011-01-31 05:03:45826<div class="paragraph"><p>says nothing.</p></div>
827<div class="paragraph"><p>Then we rebase the <em>pu</em> branch as usual.</p></div>
Junio C Hamanod97409f2006-10-03 08:41:56828<div class="listingblock">
829<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49830<pre><tt>$ git checkout pu
Junio C Hamanod97409f2006-10-03 08:41:56831$ git tag pu-anchor pu
832$ git rebase master
833* Applying: Redo "revert" using three-way merge machinery.
834First trying simple merge strategy to cherry-pick.
Junio C Hamanod97409f2006-10-03 08:41:56835* Applying: Remove git-apply-patch-script.
836First trying simple merge strategy to cherry-pick.
837Simple cherry-pick fails; trying Automatic cherry-pick.
838Removing Documentation/git-apply-patch-script.txt
839Removing git-apply-patch-script
Junio C Hamanod97409f2006-10-03 08:41:56840* Applying: Document "git cherry-pick" and "git revert"
841First trying simple merge strategy to cherry-pick.
Junio C Hamanod97409f2006-10-03 08:41:56842* Applying: mailinfo and applymbox updates
843First trying simple merge strategy to cherry-pick.
Junio C Hamanod97409f2006-10-03 08:41:56844* Applying: Show commits in topo order and name all commits.
845First trying simple merge strategy to cherry-pick.
Junio C Hamanod97409f2006-10-03 08:41:56846* Applying: More documentation updates.
Junio C Hamano61525f92014-01-17 22:46:49847First trying simple merge strategy to cherry-pick.</tt></pre>
Junio C Hamanod97409f2006-10-03 08:41:56848</div></div>
Junio C Hamano103b5722011-01-31 05:03:45849<div class="paragraph"><p>The temporary tag <em>pu-anchor</em> is me just being careful, in case <em>git
Junio C Hamano0868a302008-07-22 09:20:44850rebase</em> screws up. After this, I can do these for sanity check:</p></div>
Junio C Hamanod97409f2006-10-03 08:41:56851<div class="listingblock">
852<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49853<pre><tt>$ git diff pu-anchor..pu ;# make sure we got the master fix.
Junio C Hamanod97409f2006-10-03 08:41:56854$ make CC=gcc-2.95 clean test ;# make sure it fixed the breakage.
Junio C Hamano61525f92014-01-17 22:46:49855$ make clean test ;# make sure it did not cause other breakage.</tt></pre>
Junio C Hamanod97409f2006-10-03 08:41:56856</div></div>
Junio C Hamano103b5722011-01-31 05:03:45857<div class="paragraph"><p>Everything is in the good order. I do not need the temporary branch
Junio C Hamanod75148a2014-04-08 19:48:38858or tag anymore, so remove them:</p></div>
Junio C Hamanod97409f2006-10-03 08:41:56859<div class="listingblock">
860<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49861<pre><tt>$ rm -f .git/refs/tags/pu-anchor
862$ git branch -d revert-c99</tt></pre>
Junio C Hamanod97409f2006-10-03 08:41:56863</div></div>
Junio C Hamano103b5722011-01-31 05:03:45864<div class="paragraph"><p>It was an emergency fix, so we might as well merge it into the
Junio C Hamanod97409f2006-10-03 08:41:56865<em>release candidate</em> branch, although I expect the next release would
Junio C Hamano0868a302008-07-22 09:20:44866be some days off:</p></div>
Junio C Hamanod97409f2006-10-03 08:41:56867<div class="listingblock">
868<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49869<pre><tt>$ git checkout rc
Junio C Hamanod97409f2006-10-03 08:41:56870$ git pull . master
871Packing 0 objects
872Unpacking 0 objects
873
Junio C Hamanoe6f28d02013-09-17 21:34:00874* commit-ish: e3a693c... refs/heads/master from .
Junio C Hamanod97409f2006-10-03 08:41:56875Trying to merge e3a693c... into 8c1f5f0... using 10d781b...
876Committed merge 7fb9b7262a1d1e0a47bbfdcbbcf50ce0635d3f8f
877 cache.h | 8 ++++----
878 commit.c | 2 +-
879 ls-files.c | 2 +-
880 receive-pack.c | 2 +-
881 server-info.c | 2 +-
Junio C Hamano61525f92014-01-17 22:46:49882 5 files changed, 8 insertions(+), 8 deletions(-)</tt></pre>
Junio C Hamanod97409f2006-10-03 08:41:56883</div></div>
Junio C Hamano103b5722011-01-31 05:03:45884<div class="paragraph"><p>And the final repository status looks like this:</p></div>
Junio C Hamanod97409f2006-10-03 08:41:56885<div class="listingblock">
886<div class="content">
Junio C Hamano61525f92014-01-17 22:46:49887<pre><tt>$ git show-branch --more=1 master pu rc
Junio C Hamanod97409f2006-10-03 08:41:56888! [master] Revert "Replace zero-length array decls with []."
889 ! [pu] git-repack: Add option to repack all objects.
890 * [rc] Merge refs/heads/master from .
891---
892 + [pu] git-repack: Add option to repack all objects.
893 + [pu~1] More documentation updates.
894 + [pu~2] Show commits in topo order and name all commits.
895 + [pu~3] mailinfo and applymbox updates
896 + [pu~4] Document "git cherry-pick" and "git revert"
897 + [pu~5] Remove git-apply-patch-script.
898 + [pu~6] Redo "revert" using three-way merge machinery.
899 - [rc] Merge refs/heads/master from .
900++* [master] Revert "Replace zero-length array decls with []."
901 - [rc~1] Merge refs/heads/master from .
Junio C Hamano61525f92014-01-17 22:46:49902... [master~1] Merge refs/heads/portable from http://www.cs.berkeley....</tt></pre>
Junio C Hamanod97409f2006-10-03 08:41:56903</div></div>
904</div>
905</div>
Junio C Hamano7bd050f2011-09-22 06:32:22906</div>
907<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:23908<div id="footer">
909<div id="footer-text">
Junio C Hamanod75148a2014-04-08 19:48:38910Last updated 2014-04-08 12:47:41 PDT
Junio C Hamano1a4e8412005-12-27 08:17:23911</div>
912</div>
913</body>
914</html>