blob: 702e122c4fb68dd4ae1830b5a406a44b9288c6a8 [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 Hamano00b9f1a2014-09-29 23:11:286<meta name="generator" content="AsciiDoc 8.6.9" />
Junio C Hamano68cf15a2010-11-06 01:01:597<title>git-rev-parse(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 Hamano00b9f1a2014-09-29 23:11:2890.monospaced, code, pre {
91 font-family: "Courier New", Courier, monospace;
92 font-size: inherit;
93 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2394 padding: 0;
95 margin: 0;
96}
Junio C Hamano00b9f1a2014-09-29 23:11:2897pre {
98 white-space: pre-wrap;
99}
Junio C Hamano1a4e8412005-12-27 08:17:23100
Junio C Hamano9d971152012-12-19 00:43:11101#author {
Junio C Hamano1a4e8412005-12-27 08:17:23102 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23103 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:31104 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23105}
Junio C Hamano9d971152012-12-19 00:43:11106#email {
Junio C Hamano1a4e8412005-12-27 08:17:23107}
Junio C Hamano9d971152012-12-19 00:43:11108#revnumber, #revdate, #revremark {
Junio C Hamano1a4e8412005-12-27 08:17:23109}
110
Junio C Hamano9d971152012-12-19 00:43:11111#footer {
Junio C Hamano1a4e8412005-12-27 08:17:23112 font-size: small;
113 border-top: 2px solid silver;
114 padding-top: 0.5em;
115 margin-top: 4.0em;
116}
Junio C Hamano9d971152012-12-19 00:43:11117#footer-text {
Junio C Hamano1a4e8412005-12-27 08:17:23118 float: left;
119 padding-bottom: 0.5em;
120}
Junio C Hamano9d971152012-12-19 00:43:11121#footer-badges {
Junio C Hamano1a4e8412005-12-27 08:17:23122 float: right;
123 padding-bottom: 0.5em;
124}
125
Junio C Hamano9d971152012-12-19 00:43:11126#preamble {
Junio C Hamano68cf15a2010-11-06 01:01:59127 margin-top: 1.5em;
128 margin-bottom: 1.5em;
129}
Junio C Hamano9d971152012-12-19 00:43:11130div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamano1a4e8412005-12-27 08:17:23131div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
132div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22133 margin-top: 1.0em;
Junio C Hamano1a4e8412005-12-27 08:17:23134 margin-bottom: 1.5em;
135}
136div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22137 margin-top: 2.0em;
138 margin-bottom: 2.0em;
139 margin-right: 10%;
140 color: #606060;
Junio C Hamano1a4e8412005-12-27 08:17:23141}
142
143div.content { /* Block element content. */
144 padding: 0;
145}
146
147/* Block element titles. */
148div.title, caption.title {
Junio C Hamano68cf15a2010-11-06 01:01:59149 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23150 font-weight: bold;
151 text-align: left;
152 margin-top: 1.0em;
153 margin-bottom: 0.5em;
154}
155div.title + * {
156 margin-top: 0;
157}
158
159td div.title:first-child {
160 margin-top: 0.0em;
161}
162div.content div.title:first-child {
163 margin-top: 0.0em;
164}
165div.content + div.title {
166 margin-top: 0.0em;
167}
168
169div.sidebarblock > div.content {
170 background: #ffffee;
Junio C Hamano9d971152012-12-19 00:43:11171 border: 1px solid #dddddd;
172 border-left: 4px solid #f0f0f0;
Junio C Hamano1a4e8412005-12-27 08:17:23173 padding: 0.5em;
174}
175
176div.listingblock > div.content {
Junio C Hamano9d971152012-12-19 00:43:11177 border: 1px solid #dddddd;
178 border-left: 5px solid #f0f0f0;
179 background: #f8f8f8;
Junio C Hamano1a4e8412005-12-27 08:17:23180 padding: 0.5em;
181}
182
Junio C Hamano7bd050f2011-09-22 06:32:22183div.quoteblock, div.verseblock {
184 padding-left: 1.0em;
185 margin-left: 1.0em;
Junio C Hamano68cf15a2010-11-06 01:01:59186 margin-right: 10%;
Junio C Hamano9d971152012-12-19 00:43:11187 border-left: 5px solid #f0f0f0;
188 color: #888;
Junio C Hamano1a4e8412005-12-27 08:17:23189}
Junio C Hamano7bd050f2011-09-22 06:32:22190
Junio C Hamano68cf15a2010-11-06 01:01:59191div.quoteblock > div.attribution {
192 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23193 text-align: right;
194}
Junio C Hamano68cf15a2010-11-06 01:01:59195
Junio C Hamano9d971152012-12-19 00:43:11196div.verseblock > pre.content {
197 font-family: inherit;
198 font-size: inherit;
Junio C Hamano68cf15a2010-11-06 01:01:59199}
200div.verseblock > div.attribution {
201 padding-top: 0.75em;
202 text-align: left;
203}
204/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31205div.verseblock + div.attribution {
206 text-align: left;
207}
Junio C Hamano1a4e8412005-12-27 08:17:23208
209div.admonitionblock .icon {
210 vertical-align: top;
211 font-size: 1.1em;
212 font-weight: bold;
213 text-decoration: underline;
214 color: #527bbd;
215 padding-right: 0.5em;
216}
217div.admonitionblock td.content {
218 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22219 border-left: 3px solid #dddddd;
Junio C Hamano1a4e8412005-12-27 08:17:23220}
221
222div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22223 border-left: 3px solid #dddddd;
224 padding-left: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23225}
226
Junio C Hamano1a4e8412005-12-27 08:17:23227div.imageblock div.content { padding-left: 0; }
Junio C Hamano00b9f1a2014-09-29 23:11:28228span.image img { border-style: none; vertical-align: text-bottom; }
Junio C Hamano68cf15a2010-11-06 01:01:59229a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23230
231dl {
232 margin-top: 0.8em;
233 margin-bottom: 0.8em;
234}
235dt {
236 margin-top: 0.5em;
237 margin-bottom: 0;
Junio C Hamano68cf15a2010-11-06 01:01:59238 font-style: normal;
239 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23240}
241dd > *:first-child {
Junio C Hamano68cf15a2010-11-06 01:01:59242 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23243}
244
245ul, ol {
246 list-style-position: outside;
247}
Junio C Hamano68cf15a2010-11-06 01:01:59248ol.arabic {
249 list-style-type: decimal;
250}
251ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23252 list-style-type: lower-alpha;
253}
Junio C Hamano68cf15a2010-11-06 01:01:59254ol.upperalpha {
255 list-style-type: upper-alpha;
256}
257ol.lowerroman {
258 list-style-type: lower-roman;
259}
260ol.upperroman {
261 list-style-type: upper-roman;
262}
263
264div.compact ul, div.compact ol,
265div.compact p, div.compact p,
266div.compact div, div.compact div {
267 margin-top: 0.1em;
268 margin-bottom: 0.1em;
269}
Junio C Hamano1a4e8412005-12-27 08:17:23270
Junio C Hamano1a4e8412005-12-27 08:17:23271tfoot {
272 font-weight: bold;
273}
Junio C Hamano68cf15a2010-11-06 01:01:59274td > div.verse {
275 white-space: pre;
276}
Junio C Hamano68cf15a2010-11-06 01:01:59277
278div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23279 margin-top: 0.8em;
280 margin-bottom: 0.8em;
281}
Junio C Hamano68cf15a2010-11-06 01:01:59282div.hdlist tr {
283 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31284}
Junio C Hamano68cf15a2010-11-06 01:01:59285dt.hdlist1.strong, td.hdlist1.strong {
286 font-weight: bold;
287}
288td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23289 vertical-align: top;
Junio C Hamano68cf15a2010-11-06 01:01:59290 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23291 padding-right: 0.8em;
Junio C Hamano68cf15a2010-11-06 01:01:59292 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23293}
Junio C Hamano68cf15a2010-11-06 01:01:59294td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23295 vertical-align: top;
296}
Junio C Hamano68cf15a2010-11-06 01:01:59297div.hdlist.compact tr {
298 margin: 0;
299 padding-bottom: 0;
300}
301
302.comment {
303 background: yellow;
304}
Junio C Hamano1a4e8412005-12-27 08:17:23305
Junio C Hamano7bd050f2011-09-22 06:32:22306.footnote, .footnoteref {
307 font-size: 0.8em;
308}
309
310span.footnote, span.footnoteref {
311 vertical-align: super;
312}
313
314#footnotes {
315 margin: 20px 0 20px 0;
316 padding: 7px 0 0 0;
317}
318
319#footnotes div.footnote {
320 margin: 0 0 5px 0;
321}
322
323#footnotes hr {
324 border: none;
325 border-top: 1px solid silver;
326 height: 1px;
327 text-align: left;
328 margin-left: 0;
329 width: 20%;
330 min-width: 100px;
331}
332
Junio C Hamano9d971152012-12-19 00:43:11333div.colist td {
334 padding-right: 0.5em;
335 padding-bottom: 0.3em;
336 vertical-align: top;
337}
338div.colist td img {
339 margin-top: 0.3em;
Junio C Hamano1a4e8412005-12-27 08:17:23340}
Junio C Hamanoba4b9282008-07-06 05:20:31341
Junio C Hamano9d971152012-12-19 00:43:11342@media print {
343 #footer-badges { display: none; }
344}
345
346#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22347 margin-bottom: 2.5em;
348}
349
Junio C Hamano9d971152012-12-19 00:43:11350#toctitle {
Junio C Hamanoba4b9282008-07-06 05:20:31351 color: #527bbd;
Junio C Hamanoba4b9282008-07-06 05:20:31352 font-size: 1.1em;
353 font-weight: bold;
354 margin-top: 1.0em;
355 margin-bottom: 0.1em;
356}
357
Junio C Hamano00b9f1a2014-09-29 23:11:28358div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamanoba4b9282008-07-06 05:20:31359 margin-top: 0;
360 margin-bottom: 0;
361}
362div.toclevel2 {
363 margin-left: 2em;
364 font-size: 0.9em;
365}
366div.toclevel3 {
367 margin-left: 4em;
368 font-size: 0.9em;
369}
370div.toclevel4 {
371 margin-left: 6em;
372 font-size: 0.9em;
373}
Junio C Hamano9d971152012-12-19 00:43:11374
375span.aqua { color: aqua; }
376span.black { color: black; }
377span.blue { color: blue; }
378span.fuchsia { color: fuchsia; }
379span.gray { color: gray; }
380span.green { color: green; }
381span.lime { color: lime; }
382span.maroon { color: maroon; }
383span.navy { color: navy; }
384span.olive { color: olive; }
385span.purple { color: purple; }
386span.red { color: red; }
387span.silver { color: silver; }
388span.teal { color: teal; }
389span.white { color: white; }
390span.yellow { color: yellow; }
391
392span.aqua-background { background: aqua; }
393span.black-background { background: black; }
394span.blue-background { background: blue; }
395span.fuchsia-background { background: fuchsia; }
396span.gray-background { background: gray; }
397span.green-background { background: green; }
398span.lime-background { background: lime; }
399span.maroon-background { background: maroon; }
400span.navy-background { background: navy; }
401span.olive-background { background: olive; }
402span.purple-background { background: purple; }
403span.red-background { background: red; }
404span.silver-background { background: silver; }
405span.teal-background { background: teal; }
406span.white-background { background: white; }
407span.yellow-background { background: yellow; }
408
409span.big { font-size: 2em; }
410span.small { font-size: 0.6em; }
411
412span.underline { text-decoration: underline; }
413span.overline { text-decoration: overline; }
414span.line-through { text-decoration: line-through; }
415
Junio C Hamano00b9f1a2014-09-29 23:11:28416div.unbreakable { page-break-inside: avoid; }
417
Junio C Hamano9d971152012-12-19 00:43:11418
419/*
420 * xhtml11 specific
421 *
422 * */
423
424div.tableblock {
425 margin-top: 1.0em;
426 margin-bottom: 1.5em;
427}
428div.tableblock > table {
429 border: 3px solid #527bbd;
430}
431thead, p.table.header {
432 font-weight: bold;
433 color: #527bbd;
434}
435p.table {
436 margin-top: 0;
437}
438/* Because the table frame attribute is overriden by CSS in most browsers. */
439div.tableblock > table[frame="void"] {
440 border-style: none;
441}
442div.tableblock > table[frame="hsides"] {
443 border-left-style: none;
444 border-right-style: none;
445}
446div.tableblock > table[frame="vsides"] {
447 border-top-style: none;
448 border-bottom-style: none;
449}
450
451
452/*
453 * html5 specific
454 *
455 * */
456
457table.tableblock {
458 margin-top: 1.0em;
459 margin-bottom: 1.5em;
460}
461thead, p.tableblock.header {
462 font-weight: bold;
463 color: #527bbd;
464}
465p.tableblock {
466 margin-top: 0;
467}
468table.tableblock {
469 border-width: 3px;
470 border-spacing: 0px;
471 border-style: solid;
472 border-color: #527bbd;
473 border-collapse: collapse;
474}
475th.tableblock, td.tableblock {
476 border-width: 1px;
477 padding: 4px;
478 border-style: solid;
479 border-color: #527bbd;
480}
481
482table.tableblock.frame-topbot {
483 border-left-style: hidden;
484 border-right-style: hidden;
485}
486table.tableblock.frame-sides {
487 border-top-style: hidden;
488 border-bottom-style: hidden;
489}
490table.tableblock.frame-none {
491 border-style: hidden;
492}
493
494th.tableblock.halign-left, td.tableblock.halign-left {
495 text-align: left;
496}
497th.tableblock.halign-center, td.tableblock.halign-center {
498 text-align: center;
499}
500th.tableblock.halign-right, td.tableblock.halign-right {
501 text-align: right;
502}
503
504th.tableblock.valign-top, td.tableblock.valign-top {
505 vertical-align: top;
506}
507th.tableblock.valign-middle, td.tableblock.valign-middle {
508 vertical-align: middle;
509}
510th.tableblock.valign-bottom, td.tableblock.valign-bottom {
511 vertical-align: bottom;
512}
513
514
515/*
516 * manpage specific
517 *
518 * */
519
520body.manpage h1 {
Junio C Hamano68cf15a2010-11-06 01:01:59521 padding-top: 0.5em;
522 padding-bottom: 0.5em;
523 border-top: 2px solid silver;
524 border-bottom: 2px solid silver;
525}
Junio C Hamano9d971152012-12-19 00:43:11526body.manpage h2 {
Junio C Hamano68cf15a2010-11-06 01:01:59527 border-style: none;
528}
Junio C Hamano9d971152012-12-19 00:43:11529body.manpage div.sectionbody {
530 margin-left: 3em;
Junio C Hamano68cf15a2010-11-06 01:01:59531}
532
533@media print {
Junio C Hamano9d971152012-12-19 00:43:11534 body.manpage div#toc { display: none; }
Junio C Hamano68cf15a2010-11-06 01:01:59535}
Junio C Hamano00b9f1a2014-09-29 23:11:28536
537
Junio C Hamano1a4e8412005-12-27 08:17:23538</style>
Junio C Hamano7bd050f2011-09-22 06:32:22539<script type="text/javascript">
540/*<![CDATA[*/
Junio C Hamano7bd050f2011-09-22 06:32:22541var asciidoc = { // Namespace.
542
543/////////////////////////////////////////////////////////////////////
544// Table Of Contents generator
545/////////////////////////////////////////////////////////////////////
546
547/* Author: Mihai Bazon, September 2002
548 * http://students.infoiasi.ro/~mishoo
549 *
550 * Table Of Content generator
551 * Version: 0.4
552 *
553 * Feel free to use this script under the terms of the GNU General Public
554 * License, as long as you do not remove or alter this notice.
555 */
556
557 /* modified by Troy D. Hanson, September 2006. License: GPL */
558 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
559
560// toclevels = 1..4.
561toc: function (toclevels) {
562
563 function getText(el) {
564 var text = "";
565 for (var i = el.firstChild; i != null; i = i.nextSibling) {
566 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
567 text += i.data;
568 else if (i.firstChild != null)
569 text += getText(i);
570 }
571 return text;
572 }
573
574 function TocEntry(el, text, toclevel) {
575 this.element = el;
576 this.text = text;
577 this.toclevel = toclevel;
578 }
579
580 function tocEntries(el, toclevels) {
581 var result = new Array;
Junio C Hamano00b9f1a2014-09-29 23:11:28582 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
Junio C Hamano7bd050f2011-09-22 06:32:22583 // Function that scans the DOM tree for header elements (the DOM2
584 // nodeIterator API would be a better technique but not supported by all
585 // browsers).
586 var iterate = function (el) {
587 for (var i = el.firstChild; i != null; i = i.nextSibling) {
588 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
589 var mo = re.exec(i.tagName);
590 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
591 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
592 }
593 iterate(i);
594 }
595 }
596 }
597 iterate(el);
598 return result;
599 }
600
601 var toc = document.getElementById("toc");
Junio C Hamano9d971152012-12-19 00:43:11602 if (!toc) {
603 return;
604 }
605
606 // Delete existing TOC entries in case we're reloading the TOC.
607 var tocEntriesToRemove = [];
608 var i;
609 for (i = 0; i < toc.childNodes.length; i++) {
610 var entry = toc.childNodes[i];
Junio C Hamano00b9f1a2014-09-29 23:11:28611 if (entry.nodeName.toLowerCase() == 'div'
Junio C Hamano9d971152012-12-19 00:43:11612 && entry.getAttribute("class")
613 && entry.getAttribute("class").match(/^toclevel/))
614 tocEntriesToRemove.push(entry);
615 }
616 for (i = 0; i < tocEntriesToRemove.length; i++) {
617 toc.removeChild(tocEntriesToRemove[i]);
618 }
619
620 // Rebuild TOC entries.
Junio C Hamano7bd050f2011-09-22 06:32:22621 var entries = tocEntries(document.getElementById("content"), toclevels);
622 for (var i = 0; i < entries.length; ++i) {
623 var entry = entries[i];
624 if (entry.element.id == "")
625 entry.element.id = "_toc_" + i;
626 var a = document.createElement("a");
627 a.href = "#" + entry.element.id;
628 a.appendChild(document.createTextNode(entry.text));
629 var div = document.createElement("div");
630 div.appendChild(a);
631 div.className = "toclevel" + entry.toclevel;
632 toc.appendChild(div);
633 }
634 if (entries.length == 0)
635 toc.parentNode.removeChild(toc);
636},
637
638
639/////////////////////////////////////////////////////////////////////
640// Footnotes generator
641/////////////////////////////////////////////////////////////////////
642
643/* Based on footnote generation code from:
644 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
645 */
646
647footnotes: function () {
Junio C Hamano9d971152012-12-19 00:43:11648 // Delete existing footnote entries in case we're reloading the footnodes.
649 var i;
Junio C Hamano7bd050f2011-09-22 06:32:22650 var noteholder = document.getElementById("footnotes");
Junio C Hamano9d971152012-12-19 00:43:11651 if (!noteholder) {
652 return;
653 }
654 var entriesToRemove = [];
655 for (i = 0; i < noteholder.childNodes.length; i++) {
656 var entry = noteholder.childNodes[i];
Junio C Hamano00b9f1a2014-09-29 23:11:28657 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
Junio C Hamano9d971152012-12-19 00:43:11658 entriesToRemove.push(entry);
659 }
660 for (i = 0; i < entriesToRemove.length; i++) {
661 noteholder.removeChild(entriesToRemove[i]);
662 }
663
664 // Rebuild footnote entries.
665 var cont = document.getElementById("content");
Junio C Hamano7bd050f2011-09-22 06:32:22666 var spans = cont.getElementsByTagName("span");
667 var refs = {};
668 var n = 0;
669 for (i=0; i<spans.length; i++) {
670 if (spans[i].className == "footnote") {
671 n++;
Junio C Hamano9d971152012-12-19 00:43:11672 var note = spans[i].getAttribute("data-note");
673 if (!note) {
674 // Use [\s\S] in place of . so multi-line matches work.
675 // Because JavaScript has no s (dotall) regex flag.
676 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
677 spans[i].innerHTML =
678 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
679 "' title='View footnote' class='footnote'>" + n + "</a>]";
680 spans[i].setAttribute("data-note", note);
681 }
Junio C Hamano7bd050f2011-09-22 06:32:22682 noteholder.innerHTML +=
683 "<div class='footnote' id='_footnote_" + n + "'>" +
684 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
685 n + "</a>. " + note + "</div>";
Junio C Hamano7bd050f2011-09-22 06:32:22686 var id =spans[i].getAttribute("id");
687 if (id != null) refs["#"+id] = n;
688 }
689 }
690 if (n == 0)
691 noteholder.parentNode.removeChild(noteholder);
692 else {
693 // Process footnoterefs.
694 for (i=0; i<spans.length; i++) {
695 if (spans[i].className == "footnoteref") {
696 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
697 href = href.match(/#.*/)[0]; // Because IE return full URL.
698 n = refs[href];
699 spans[i].innerHTML =
700 "[<a href='#_footnote_" + n +
701 "' title='View footnote' class='footnote'>" + n + "</a>]";
702 }
703 }
704 }
Junio C Hamano9d971152012-12-19 00:43:11705},
706
707install: function(toclevels) {
708 var timerId;
709
710 function reinstall() {
711 asciidoc.footnotes();
712 if (toclevels) {
713 asciidoc.toc(toclevels);
714 }
715 }
716
717 function reinstallAndRemoveTimer() {
718 clearInterval(timerId);
719 reinstall();
720 }
721
722 timerId = setInterval(reinstall, 500);
723 if (document.addEventListener)
724 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
725 else
726 window.onload = reinstallAndRemoveTimer;
Junio C Hamano7bd050f2011-09-22 06:32:22727}
728
729}
Junio C Hamano9d971152012-12-19 00:43:11730asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22731/*]]>*/
732</script>
Junio C Hamano1a4e8412005-12-27 08:17:23733</head>
Junio C Hamano9d971152012-12-19 00:43:11734<body class="manpage">
Junio C Hamano1a4e8412005-12-27 08:17:23735<div id="header">
736<h1>
737git-rev-parse(1) Manual Page
738</h1>
739<h2>NAME</h2>
740<div class="sectionbody">
741<p>git-rev-parse -
Junio C Hamano01078922006-03-10 00:31:47742 Pick out and massage parameters
Junio C Hamano1a4e8412005-12-27 08:17:23743</p>
744</div>
745</div>
Junio C Hamano7bd050f2011-09-22 06:32:22746<div id="content">
Junio C Hamano9d971152012-12-19 00:43:11747<div class="sect1">
Junio C Hamano68cf15a2010-11-06 01:01:59748<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23749<div class="sectionbody">
Junio C Hamano15567bc2011-07-23 00:51:59750<div class="verseblock">
Junio C Hamano9d971152012-12-19 00:43:11751<pre class="content"><em>git rev-parse</em> [ --option ] &lt;args&gt;&#8230;</pre>
752<div class="attribution">
Junio C Hamano15567bc2011-07-23 00:51:59753</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23754</div>
Junio C Hamano9d971152012-12-19 00:43:11755</div>
756<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31757<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23758<div class="sectionbody">
Junio C Hamano076ffcc2013-02-06 05:13:21759<div class="paragraph"><p>Many Git porcelainish commands take mixture of flags
Junio C Hamano1a4e8412005-12-27 08:17:23760(i.e. parameters that begin with a dash <em>-</em>) and parameters
Junio C Hamano1aa40d22010-01-21 17:46:43761meant for the underlying <em>git rev-list</em> command they use internally
Junio C Hamanofce7c7e2008-07-02 03:06:38762and flags and parameters for the other commands they use
Junio C Hamano1aa40d22010-01-21 17:46:43763downstream of <em>git rev-list</em>. This command is used to
Junio C Hamanoba4b9282008-07-06 05:20:31764distinguish between them.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23765</div>
Junio C Hamano9d971152012-12-19 00:43:11766</div>
767<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31768<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23769<div class="sectionbody">
Junio C Hamano0241d052013-08-30 23:52:17770<div class="sect2">
771<h3 id="_operation_modes">Operation Modes</h3>
772<div class="paragraph"><p>Each of these options must appear first on the command line.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:59773<div class="dlist"><dl>
774<dt class="hdlist1">
Junio C Hamanoe1258662007-11-19 05:03:19775--parseopt
776</dt>
777<dd>
778<p>
Junio C Hamano1aa40d22010-01-21 17:46:43779 Use <em>git rev-parse</em> in option parsing mode (see PARSEOPT section below).
Junio C Hamanoe1258662007-11-19 05:03:19780</p>
781</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59782<dt class="hdlist1">
Junio C Hamano0241d052013-08-30 23:52:17783--sq-quote
784</dt>
785<dd>
786<p>
787 Use <em>git rev-parse</em> in shell quoting mode (see SQ-QUOTE
Junio C Hamano00b9f1a2014-09-29 23:11:28788 section below). In contrast to the <code>--sq</code> option below, this
Junio C Hamano0241d052013-08-30 23:52:17789 mode does only quoting. Nothing else is done to command input.
790</p>
791</dd>
792</dl></div>
793</div>
794<div class="sect2">
795<h3 id="_options_for_parseopt">Options for --parseopt</h3>
796<div class="dlist"><dl>
797<dt class="hdlist1">
Junio C Hamanoa9499de2009-04-30 03:38:48798--keep-dashdash
Junio C Hamanoe1258662007-11-19 05:03:19799</dt>
800<dd>
801<p>
Junio C Hamano00b9f1a2014-09-29 23:11:28802 Only meaningful in <code>--parseopt</code> mode. Tells the option parser to echo
803 out the first <code>--</code> met instead of skipping it.
Junio C Hamanoe1258662007-11-19 05:03:19804</p>
805</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59806<dt class="hdlist1">
Junio C Hamanoccc4d372009-07-06 18:05:38807--stop-at-non-option
808</dt>
809<dd>
810<p>
Junio C Hamano00b9f1a2014-09-29 23:11:28811 Only meaningful in <code>--parseopt</code> mode. Lets the option parser stop at
Junio C Hamanoccc4d372009-07-06 18:05:38812 the first non-option argument. This can be used to parse sub-commands
Junio C Hamano167b1382010-01-31 23:04:31813 that take options themselves.
Junio C Hamanoccc4d372009-07-06 18:05:38814</p>
815</dd>
Junio C Hamanof079f702013-12-06 23:43:18816<dt class="hdlist1">
817--stuck-long
818</dt>
819<dd>
820<p>
Junio C Hamano00b9f1a2014-09-29 23:11:28821 Only meaningful in <code>--parseopt</code> mode. Output the options in their
Junio C Hamanof079f702013-12-06 23:43:18822 long form if available, and with their arguments stuck.
823</p>
824</dd>
Junio C Hamano0241d052013-08-30 23:52:17825</dl></div>
826</div>
827<div class="sect2">
828<h3 id="_options_for_filtering">Options for Filtering</h3>
829<div class="dlist"><dl>
Junio C Hamano68cf15a2010-11-06 01:01:59830<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23831--revs-only
832</dt>
833<dd>
834<p>
835 Do not output flags and parameters not meant for
Junio C Hamano1aa40d22010-01-21 17:46:43836 <em>git rev-list</em> command.
Junio C Hamano1a4e8412005-12-27 08:17:23837</p>
838</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59839<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23840--no-revs
841</dt>
842<dd>
843<p>
844 Do not output flags and parameters meant for
Junio C Hamano1aa40d22010-01-21 17:46:43845 <em>git rev-list</em> command.
Junio C Hamano1a4e8412005-12-27 08:17:23846</p>
847</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59848<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23849--flags
850</dt>
851<dd>
852<p>
853 Do not output non-flag parameters.
854</p>
855</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59856<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23857--no-flags
858</dt>
859<dd>
860<p>
861 Do not output flag parameters.
862</p>
863</dd>
Junio C Hamano0241d052013-08-30 23:52:17864</dl></div>
865</div>
866<div class="sect2">
867<h3 id="_options_for_output">Options for Output</h3>
868<div class="dlist"><dl>
Junio C Hamano68cf15a2010-11-06 01:01:59869<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23870--default &lt;arg&gt;
871</dt>
872<dd>
873<p>
Junio C Hamano00b9f1a2014-09-29 23:11:28874 If there is no parameter given by the user, use <code>&lt;arg&gt;</code>
Junio C Hamano1a4e8412005-12-27 08:17:23875 instead.
876</p>
877</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59878<dt class="hdlist1">
Junio C Hamanoa1952302013-07-01 21:31:18879--prefix &lt;arg&gt;
880</dt>
881<dd>
882<p>
Junio C Hamano00b9f1a2014-09-29 23:11:28883 Behave as if <em>git rev-parse</em> was invoked from the <code>&lt;arg&gt;</code>
Junio C Hamanoa1952302013-07-01 21:31:18884 subdirectory of the working tree. Any relative filenames are
Junio C Hamano00b9f1a2014-09-29 23:11:28885 resolved as if they are prefixed by <code>&lt;arg&gt;</code> and will be printed
Junio C Hamanoa1952302013-07-01 21:31:18886 in that form.
887</p>
888<div class="paragraph"><p>This can be used to convert arguments to a command run in a subdirectory
889so that they can still be used after moving to the top-level of the
890repository. For example:</p></div>
891<div class="listingblock">
892<div class="content">
Junio C Hamano00b9f1a2014-09-29 23:11:28893<pre><code>prefix=$(git rev-parse --show-prefix)
Junio C Hamanoa1952302013-07-01 21:31:18894cd "$(git rev-parse --show-toplevel)"
Junio C Hamano00b9f1a2014-09-29 23:11:28895eval "set -- $(git rev-parse --sq --prefix "$prefix" "$@")"</code></pre>
Junio C Hamanoa1952302013-07-01 21:31:18896</div></div>
897</dd>
898<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23899--verify
900</dt>
901<dd>
902<p>
Junio C Hamanoedf80bd2013-04-05 22:14:36903 Verify that exactly one parameter is provided, and that it
904 can be turned into a raw 20-byte SHA-1 that can be used to
905 access the object database. If so, emit it to the standard
906 output; otherwise, error out.
Junio C Hamano1a4e8412005-12-27 08:17:23907</p>
Junio C Hamanoedf80bd2013-04-05 22:14:36908<div class="paragraph"><p>If you want to make sure that the output actually names an object in
909your object database and/or can be used as a specific type of object
Junio C Hamano1dbca522015-05-22 20:48:55910you require, you can add the <code>^{type}</code> peeling operator to the parameter.
Junio C Hamano00b9f1a2014-09-29 23:11:28911For example, <code>git rev-parse "$VAR^{commit}"</code> will make sure <code>$VAR</code>
Junio C Hamanoedf80bd2013-04-05 22:14:36912names an existing object that is a commit-ish (i.e. a commit, or an
Junio C Hamano00b9f1a2014-09-29 23:11:28913annotated tag that points at a commit). To make sure that <code>$VAR</code>
914names an existing object of any type, <code>git rev-parse "$VAR^{object}"</code>
Junio C Hamanoedf80bd2013-04-05 22:14:36915can be used.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23916</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59917<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47918-q
919</dt>
Junio C Hamano68cf15a2010-11-06 01:01:59920<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47921--quiet
Junio C Hamano9ab87672008-04-28 08:40:29922</dt>
923<dd>
924<p>
Junio C Hamano00b9f1a2014-09-29 23:11:28925 Only meaningful in <code>--verify</code> mode. Do not output an error
Junio C Hamano9ab87672008-04-28 08:40:29926 message if the first argument is not a valid object name;
927 instead exit with non-zero status silently.
Junio C Hamano00b9f1a2014-09-29 23:11:28928 SHA-1s for valid object names are printed to stdout on success.
Junio C Hamano9ab87672008-04-28 08:40:29929</p>
930</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59931<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23932--sq
933</dt>
934<dd>
935<p>
936 Usually the output is made one line per flag and
937 parameter. This option makes output a single line,
938 properly quoted for consumption by shell. Useful when
939 you expect your parameter to contain whitespaces and
Junio C Hamano00b9f1a2014-09-29 23:11:28940 newlines (e.g. when using pickaxe <code>-S</code> with
941 <em>git diff-&#42;</em>). In contrast to the <code>--sq-quote</code> option,
Junio C Hamano7ae18252009-05-23 09:53:32942 the command input is still interpreted as usual.
Junio C Hamano1a4e8412005-12-27 08:17:23943</p>
944</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59945<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23946--not
947</dt>
948<dd>
949<p>
Junio C Hamano6926bef2007-06-16 09:54:05950 When showing object names, prefix them with <em>&#94;</em> and
951 strip <em>&#94;</em> prefix from the object names that already have
Junio C Hamano1a4e8412005-12-27 08:17:23952 one.
953</p>
954</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59955<dt class="hdlist1">
Junio C Hamano0241d052013-08-30 23:52:17956--abbrev-ref[=(strict|loose)]
957</dt>
958<dd>
959<p>
960 A non-ambiguous short name of the objects name.
961 The option core.warnAmbiguousRefs is used to select the strict
962 abbreviation mode.
963</p>
964</dd>
965<dt class="hdlist1">
966--short
967</dt>
968<dt class="hdlist1">
969--short=number
970</dt>
971<dd>
972<p>
973 Instead of outputting the full SHA-1 values of object names try to
974 abbreviate them to a shorter unique name. When no length is specified
975 7 is used. The minimum length is 4.
976</p>
977</dd>
978<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:23979--symbolic
980</dt>
981<dd>
982<p>
Junio C Hamanoe3f080d2013-04-22 02:27:13983 Usually the object names are output in SHA-1 form (with
Junio C Hamano6926bef2007-06-16 09:54:05984 possible <em>&#94;</em> prefix); this option makes them output in a
Junio C Hamano1a4e8412005-12-27 08:17:23985 form as close to the original input as possible.
986</p>
987</dd>
Junio C Hamano68cf15a2010-11-06 01:01:59988<dt class="hdlist1">
Junio C Hamano35738e82008-01-07 07:55:46989--symbolic-full-name
990</dt>
991<dd>
992<p>
993 This is similar to --symbolic, but it omits input that
994 are not refs (i.e. branch or tag names; or more
995 explicitly disambiguating "heads/master" form, when you
996 want to name the "master" branch when there is an
997 unfortunately named tag "master"), and show them as full
998 refnames (e.g. "refs/heads/master").
999</p>
1000</dd>
Junio C Hamano0241d052013-08-30 23:52:171001</dl></div>
1002</div>
1003<div class="sect2">
1004<h3 id="_options_for_objects">Options for Objects</h3>
1005<div class="dlist"><dl>
Junio C Hamanobb300642012-07-22 21:09:141006<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231007--all
1008</dt>
1009<dd>
1010<p>
Junio C Hamano00b9f1a2014-09-29 23:11:281011 Show all refs found in <code>refs/</code>.
Junio C Hamano1a4e8412005-12-27 08:17:231012</p>
1013</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591014<dt class="hdlist1">
Junio C Hamano57827fb2010-01-23 03:02:501015--branches[=pattern]
1016</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591017<dt class="hdlist1">
Junio C Hamano57827fb2010-01-23 03:02:501018--tags[=pattern]
1019</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591020<dt class="hdlist1">
Junio C Hamano57827fb2010-01-23 03:02:501021--remotes[=pattern]
Junio C Hamano6959c6c2006-05-17 10:34:111022</dt>
1023<dd>
1024<p>
Junio C Hamano57827fb2010-01-23 03:02:501025 Show all branches, tags, or remote-tracking branches,
Junio C Hamano00b9f1a2014-09-29 23:11:281026 respectively (i.e., refs found in <code>refs/heads</code>,
1027 <code>refs/tags</code>, or <code>refs/remotes</code>, respectively).
Junio C Hamano6959c6c2006-05-17 10:34:111028</p>
Junio C Hamano00b9f1a2014-09-29 23:11:281029<div class="paragraph"><p>If a <code>pattern</code> is given, only refs matching the given shell glob are
1030shown. If the pattern does not contain a globbing character (<code>?</code>,
1031<code>*</code>, or <code>[</code>), it is turned into a prefix match by appending <code>/*</code>.</p></div>
Junio C Hamano6959c6c2006-05-17 10:34:111032</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591033<dt class="hdlist1">
Junio C Hamano57827fb2010-01-23 03:02:501034--glob=pattern
Junio C Hamano6959c6c2006-05-17 10:34:111035</dt>
1036<dd>
1037<p>
Junio C Hamano00b9f1a2014-09-29 23:11:281038 Show all refs matching the shell glob pattern <code>pattern</code>. If
1039 the pattern does not start with <code>refs/</code>, this is automatically
Junio C Hamano57827fb2010-01-23 03:02:501040 prepended. If the pattern does not contain a globbing
Junio C Hamano00b9f1a2014-09-29 23:11:281041 character (<code>?</code>, <code>*</code>, or <code>[</code>), it is turned into a prefix
1042 match by appending <code>/*</code>.
Junio C Hamano6959c6c2006-05-17 10:34:111043</p>
1044</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591045<dt class="hdlist1">
Junio C Hamanof079f702013-12-06 23:43:181046--exclude=&lt;glob-pattern&gt;
1047</dt>
1048<dd>
1049<p>
Junio C Hamano00b9f1a2014-09-29 23:11:281050 Do not include refs matching <em>&lt;glob-pattern&gt;</em> that the next <code>--all</code>,
1051 <code>--branches</code>, <code>--tags</code>, <code>--remotes</code>, or <code>--glob</code> would otherwise
Junio C Hamanof079f702013-12-06 23:43:181052 consider. Repetitions of this option accumulate exclusion patterns
Junio C Hamano00b9f1a2014-09-29 23:11:281053 up to the next <code>--all</code>, <code>--branches</code>, <code>--tags</code>, <code>--remotes</code>, or
1054 <code>--glob</code> option (other options or arguments do not clear
Junio C Hamanofb5ffde2014-11-04 22:38:561055 accumulated patterns).
Junio C Hamanof079f702013-12-06 23:43:181056</p>
Junio C Hamano00b9f1a2014-09-29 23:11:281057<div class="paragraph"><p>The patterns given should not begin with <code>refs/heads</code>, <code>refs/tags</code>, or
1058<code>refs/remotes</code> when applied to <code>--branches</code>, <code>--tags</code>, or <code>--remotes</code>,
1059respectively, and they must begin with <code>refs/</code> when applied to <code>--glob</code>
1060or <code>--all</code>. If a trailing <em>/&#42;</em> is intended, it must be given
Junio C Hamanof079f702013-12-06 23:43:181061explicitly.</p></div>
1062</dd>
1063<dt class="hdlist1">
Junio C Hamano0241d052013-08-30 23:52:171064--disambiguate=&lt;prefix&gt;
Junio C Hamanoa9701f02010-01-21 00:42:161065</dt>
1066<dd>
1067<p>
Junio C Hamano0241d052013-08-30 23:52:171068 Show every object whose name begins with the given prefix.
1069 The &lt;prefix&gt; must be at least 4 hexadecimal digits long to
1070 avoid listing each and every object in the repository by
1071 mistake.
Junio C Hamanoa9701f02010-01-21 00:42:161072</p>
1073</dd>
Junio C Hamano0241d052013-08-30 23:52:171074</dl></div>
1075</div>
1076<div class="sect2">
1077<h3 id="_options_for_files">Options for Files</h3>
1078<div class="dlist"><dl>
Junio C Hamano68cf15a2010-11-06 01:01:591079<dt class="hdlist1">
Junio C Hamano0241d052013-08-30 23:52:171080--local-env-vars
Junio C Hamano1a4e8412005-12-27 08:17:231081</dt>
1082<dd>
1083<p>
Junio C Hamano0241d052013-08-30 23:52:171084 List the GIT_* environment variables that are local to the
1085 repository (e.g. GIT_DIR or GIT_WORK_TREE, but not GIT_EDITOR).
1086 Only the names of the variables are listed, not their value,
1087 even if they are set.
Junio C Hamano1a4e8412005-12-27 08:17:231088</p>
1089</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591090<dt class="hdlist1">
Junio C Hamanoe246e3b2006-02-19 08:45:181091--git-dir
1092</dt>
1093<dd>
1094<p>
Junio C Hamano00b9f1a2014-09-29 23:11:281095 Show <code>$GIT_DIR</code> if defined. Otherwise show the path to
Junio C Hamano35cd2a82012-05-23 22:01:131096 the .git directory. The path shown, when relative, is
1097 relative to the current working directory.
Junio C Hamanoe246e3b2006-02-19 08:45:181098</p>
Junio C Hamano00b9f1a2014-09-29 23:11:281099<div class="paragraph"><p>If <code>$GIT_DIR</code> is not defined and the current directory
Junio C Hamano076ffcc2013-02-06 05:13:211100is not detected to lie in a Git repository or work tree
Junio C Hamano3609b332010-12-29 01:34:521101print a message to stderr and exit with nonzero status.</p></div>
Junio C Hamanoe246e3b2006-02-19 08:45:181102</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591103<dt class="hdlist1">
Junio C Hamano4cc4a842015-05-11 22:41:021104--git-common-dir
1105</dt>
1106<dd>
1107<p>
1108 Show <code>$GIT_COMMON_DIR</code> if defined, else <code>$GIT_DIR</code>.
1109</p>
1110</dd>
1111<dt class="hdlist1">
Junio C Hamanoee695f22007-06-21 00:35:361112--is-inside-git-dir
1113</dt>
1114<dd>
1115<p>
Junio C Hamanod526ba92007-07-02 00:17:421116 When the current working directory is below the repository
1117 directory print "true", otherwise "false".
1118</p>
1119</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591120<dt class="hdlist1">
Junio C Hamanod526ba92007-07-02 00:17:421121--is-inside-work-tree
1122</dt>
1123<dd>
1124<p>
1125 When the current working directory is inside the work tree of the
1126 repository print "true", otherwise "false".
1127</p>
1128</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591129<dt class="hdlist1">
Junio C Hamanod526ba92007-07-02 00:17:421130--is-bare-repository
1131</dt>
1132<dd>
1133<p>
1134 When the repository is bare print "true", otherwise "false".
Junio C Hamanoee695f22007-06-21 00:35:361135</p>
1136</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591137<dt class="hdlist1">
Junio C Hamano0241d052013-08-30 23:52:171138--resolve-git-dir &lt;path&gt;
Junio C Hamano636c8b22010-03-07 22:25:171139</dt>
1140<dd>
1141<p>
Junio C Hamano0241d052013-08-30 23:52:171142 Check if &lt;path&gt; is a valid repository or a gitfile that
1143 points at a valid repository, and print the location of the
1144 repository. If &lt;path&gt; is a gitfile then the resolved path
1145 to the real repository is printed.
Junio C Hamano636c8b22010-03-07 22:25:171146</p>
1147</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591148<dt class="hdlist1">
Junio C Hamano4cc4a842015-05-11 22:41:021149--git-path &lt;path&gt;
1150</dt>
1151<dd>
1152<p>
1153 Resolve "$GIT_DIR/&lt;path&gt;" and takes other path relocation
1154 variables such as $GIT_OBJECT_DIRECTORY,
1155 $GIT_INDEX_FILE&#8230; into account. For example, if
1156 $GIT_OBJECT_DIRECTORY is set to /foo/bar then "git rev-parse
1157 --git-path objects/abc" returns /foo/bar/abc.
1158</p>
1159</dd>
1160<dt class="hdlist1">
Junio C Hamano0241d052013-08-30 23:52:171161--show-cdup
Junio C Hamanoe246e3b2006-02-19 08:45:181162</dt>
1163<dd>
1164<p>
Junio C Hamano0241d052013-08-30 23:52:171165 When the command is invoked from a subdirectory, show the
1166 path of the top-level directory relative to the current
1167 directory (typically a sequence of "../", or an empty string).
Junio C Hamanoe246e3b2006-02-19 08:45:181168</p>
1169</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591170<dt class="hdlist1">
Junio C Hamano0241d052013-08-30 23:52:171171--show-prefix
1172</dt>
1173<dd>
1174<p>
1175 When the command is invoked from a subdirectory, show the
1176 path of the current directory relative to the top-level
1177 directory.
1178</p>
1179</dd>
1180<dt class="hdlist1">
1181--show-toplevel
1182</dt>
1183<dd>
1184<p>
1185 Show the absolute path of the top-level directory.
1186</p>
1187</dd>
Junio C Hamano6f0c9442014-07-16 21:51:321188<dt class="hdlist1">
1189--shared-index-path
1190</dt>
1191<dd>
1192<p>
1193 Show the path to the shared index file in split index mode, or
1194 empty if not in split-index mode.
1195</p>
1196</dd>
Junio C Hamano0241d052013-08-30 23:52:171197</dl></div>
1198</div>
1199<div class="sect2">
1200<h3 id="_other_options">Other Options</h3>
1201<div class="dlist"><dl>
1202<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471203--since=datestring
1204</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591205<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471206--after=datestring
Junio C Hamano1a4e8412005-12-27 08:17:231207</dt>
1208<dd>
1209<p>
Junio C Hamanofce7c7e2008-07-02 03:06:381210 Parse the date string, and output the corresponding
Junio C Hamano1aa40d22010-01-21 17:46:431211 --max-age= parameter for <em>git rev-list</em>.
Junio C Hamano1a4e8412005-12-27 08:17:231212</p>
1213</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591214<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471215--until=datestring
1216</dt>
Junio C Hamano68cf15a2010-11-06 01:01:591217<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:471218--before=datestring
Junio C Hamano1a4e8412005-12-27 08:17:231219</dt>
1220<dd>
1221<p>
Junio C Hamanofce7c7e2008-07-02 03:06:381222 Parse the date string, and output the corresponding
Junio C Hamano1aa40d22010-01-21 17:46:431223 --min-age= parameter for <em>git rev-list</em>.
Junio C Hamano1a4e8412005-12-27 08:17:231224</p>
1225</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591226<dt class="hdlist1">
Junio C Hamano1a4e8412005-12-27 08:17:231227&lt;args&gt;&#8230;
1228</dt>
1229<dd>
1230<p>
1231 Flags and parameters to be parsed.
1232</p>
1233</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311234</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:231235</div>
Junio C Hamano9d971152012-12-19 00:43:111236</div>
Junio C Hamano0241d052013-08-30 23:52:171237</div>
Junio C Hamano9d971152012-12-19 00:43:111238<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311239<h2 id="_specifying_revisions">SPECIFYING REVISIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231240<div class="sectionbody">
Junio C Hamanoee3adc32011-04-06 19:53:381241<div class="paragraph"><p>A revision parameter <em>&lt;rev&gt;</em> typically, but not necessarily, names a
Junio C Hamanoe3f080d2013-04-22 02:27:131242commit object. It uses what is called an <em>extended SHA-1</em>
Junio C Hamanofbe00522006-10-19 05:58:481243syntax. Here are various ways to spell object names. The
Junio C Hamanoee3adc32011-04-06 19:53:381244ones listed near the end of this list name trees and
Junio C Hamanoba4b9282008-07-06 05:20:311245blobs contained in a commit.</p></div>
Junio C Hamanoee3adc32011-04-06 19:53:381246<div class="dlist"><dl>
1247<dt class="hdlist1">
1248<em>&lt;sha1&gt;</em>, e.g. <em>dae86e1950b1277e545cee180551750029cfe735</em>, <em>dae86e</em>
1249</dt>
1250<dd>
Junio C Hamano1a4e8412005-12-27 08:17:231251<p>
Junio C Hamanoe3f080d2013-04-22 02:27:131252 The full SHA-1 object name (40-byte hexadecimal string), or
Junio C Hamanoee3adc32011-04-06 19:53:381253 a leading substring that is unique within the repository.
Junio C Hamano1a4e8412005-12-27 08:17:231254 E.g. dae86e1950b1277e545cee180551750029cfe735 and dae86e both
Junio C Hamanoee3adc32011-04-06 19:53:381255 name the same commit object if there is no other object in
Junio C Hamano1a4e8412005-12-27 08:17:231256 your repository whose object name starts with dae86e.
1257</p>
Junio C Hamanoee3adc32011-04-06 19:53:381258</dd>
1259<dt class="hdlist1">
1260<em>&lt;describeOutput&gt;</em>, e.g. <em>v1.7.4.2-679-g3bee7fb</em>
1261</dt>
1262<dd>
Junio C Hamano1a4e8412005-12-27 08:17:231263<p>
Junio C Hamano00b9f1a2014-09-29 23:11:281264 Output from <code>git describe</code>; i.e. a closest tag, optionally
Junio C Hamano7f80ae82008-07-30 18:31:351265 followed by a dash and a number of commits, followed by a dash, a
Junio C Hamanoee3adc32011-04-06 19:53:381266 <em>g</em>, and an abbreviated object name.
Junio C Hamanofbe00522006-10-19 05:58:481267</p>
Junio C Hamanoee3adc32011-04-06 19:53:381268</dd>
1269<dt class="hdlist1">
1270<em>&lt;refname&gt;</em>, e.g. <em>master</em>, <em>heads/master</em>, <em>refs/heads/master</em>
1271</dt>
1272<dd>
Junio C Hamanofbe00522006-10-19 05:58:481273<p>
Junio C Hamanoee3adc32011-04-06 19:53:381274 A symbolic ref name. E.g. <em>master</em> typically means the commit
1275 object referenced by <em>refs/heads/master</em>. If you
1276 happen to have both <em>heads/master</em> and <em>tags/master</em>, you can
Junio C Hamano076ffcc2013-02-06 05:13:211277 explicitly say <em>heads/master</em> to tell Git which one you mean.
Junio C Hamanof5933722012-07-25 23:25:211278 When ambiguous, a <em>&lt;refname&gt;</em> is disambiguated by taking the
Junio C Hamano29f14312006-10-26 08:47:291279 first match in the following rules:
1280</p>
Junio C Hamano68cf15a2010-11-06 01:01:591281<div class="olist arabic"><ol class="arabic">
Junio C Hamano29f14312006-10-26 08:47:291282<li>
1283<p>
Junio C Hamanof5933722012-07-25 23:25:211284If <em>$GIT_DIR/&lt;refname&gt;</em> exists, that is what you mean (this is usually
Junio C Hamanoee3adc32011-04-06 19:53:381285 useful only for <em>HEAD</em>, <em>FETCH_HEAD</em>, <em>ORIG_HEAD</em>, <em>MERGE_HEAD</em>
1286 and <em>CHERRY_PICK_HEAD</em>);
Junio C Hamano1a4e8412005-12-27 08:17:231287</p>
1288</li>
1289<li>
1290<p>
Junio C Hamanof5933722012-07-25 23:25:211291otherwise, <em>refs/&lt;refname&gt;</em> if it exists;
Junio C Hamano29f14312006-10-26 08:47:291292</p>
1293</li>
1294<li>
1295<p>
Junio C Hamanoee3adc32011-04-06 19:53:381296otherwise, <em>refs/tags/&lt;refname&gt;</em> if it exists;
Junio C Hamano29f14312006-10-26 08:47:291297</p>
1298</li>
1299<li>
1300<p>
Junio C Hamanof5933722012-07-25 23:25:211301otherwise, <em>refs/heads/&lt;refname&gt;</em> if it exists;
Junio C Hamano29f14312006-10-26 08:47:291302</p>
1303</li>
1304<li>
1305<p>
Junio C Hamanof5933722012-07-25 23:25:211306otherwise, <em>refs/remotes/&lt;refname&gt;</em> if it exists;
Junio C Hamano29f14312006-10-26 08:47:291307</p>
1308</li>
1309<li>
1310<p>
Junio C Hamanof5933722012-07-25 23:25:211311otherwise, <em>refs/remotes/&lt;refname&gt;/HEAD</em> if it exists.
Junio C Hamano29f14312006-10-26 08:47:291312</p>
Junio C Hamanoee3adc32011-04-06 19:53:381313<div class="paragraph"><p><em>HEAD</em> names the commit on which you based the changes in the working tree.
1314<em>FETCH_HEAD</em> records the branch which you fetched from a remote repository
Junio C Hamano00b9f1a2014-09-29 23:11:281315with your last <code>git fetch</code> invocation.
Junio C Hamanoee3adc32011-04-06 19:53:381316<em>ORIG_HEAD</em> is created by commands that move your <em>HEAD</em> in a drastic
1317way, to record the position of the <em>HEAD</em> before their operation, so that
1318you can easily change the tip of the branch back to the state before you ran
1319them.
1320<em>MERGE_HEAD</em> records the commit(s) which you are merging into your branch
Junio C Hamano00b9f1a2014-09-29 23:11:281321when you run <code>git merge</code>.
Junio C Hamanoee3adc32011-04-06 19:53:381322<em>CHERRY_PICK_HEAD</em> records the commit which you are cherry-picking
Junio C Hamano00b9f1a2014-09-29 23:11:281323when you run <code>git cherry-pick</code>.</p></div>
Junio C Hamanoee3adc32011-04-06 19:53:381324<div class="paragraph"><p>Note that any of the <em>refs/*</em> cases above may come either from
Junio C Hamanoeccdd4a2012-09-10 23:28:171325the <em>$GIT_DIR/refs</em> directory or from the <em>$GIT_DIR/packed-refs</em> file.
Junio C Hamanoa080bc32013-04-12 21:33:011326While the ref name encoding is unspecified, UTF-8 is preferred as
Junio C Hamanoeccdd4a2012-09-10 23:28:171327some output processing may assume ref names in UTF-8.</p></div>
Junio C Hamano29f14312006-10-26 08:47:291328</li>
Junio C Hamanoba4b9282008-07-06 05:20:311329</ol></div>
Junio C Hamanoee3adc32011-04-06 19:53:381330</dd>
1331<dt class="hdlist1">
Junio C Hamano79f4c7c2013-09-20 21:03:371332<em>@</em>
1333</dt>
1334<dd>
1335<p>
1336 <em>@</em> alone is a shortcut for <em>HEAD</em>.
1337</p>
1338</dd>
1339<dt class="hdlist1">
Junio C Hamanoee3adc32011-04-06 19:53:381340<em>&lt;refname&gt;@{&lt;date&gt;}</em>, e.g. <em>master@{yesterday}</em>, <em>HEAD@{5 minutes ago}</em>
1341</dt>
1342<dd>
Junio C Hamano29f14312006-10-26 08:47:291343<p>
Junio C Hamanoee3adc32011-04-06 19:53:381344 A ref followed by the suffix <em>@</em> with a date specification
Junio C Hamano29f14312006-10-26 08:47:291345 enclosed in a brace
Junio C Hamano341071d2006-06-04 07:24:481346 pair (e.g. <em>{yesterday}</em>, <em>{1 month 2 weeks 3 days 1 hour 1
Junio C Hamanoee3adc32011-04-06 19:53:381347 second ago}</em> or <em>{1979-02-26 18:30:00}</em>) specifies the value
Junio C Hamano341071d2006-06-04 07:24:481348 of the ref at a prior point in time. This suffix may only be
1349 used immediately following a ref name and the ref must have an
Junio C Hamanoee3adc32011-04-06 19:53:381350 existing log (<em>$GIT_DIR/logs/&lt;ref&gt;</em>). Note that this looks up the state
Junio C Hamanobb8e9962008-06-30 09:05:081351 of your <strong>local</strong> ref at a given time; e.g., what was in your local
Junio C Hamanoee3adc32011-04-06 19:53:381352 <em>master</em> branch last week. If you want to look at commits made during
1353 certain times, see <em>--since</em> and <em>--until</em>.
Junio C Hamano341071d2006-06-04 07:24:481354</p>
Junio C Hamanoee3adc32011-04-06 19:53:381355</dd>
1356<dt class="hdlist1">
1357<em>&lt;refname&gt;@{&lt;n&gt;}</em>, e.g. <em>master@{1}</em>
1358</dt>
1359<dd>
Junio C Hamano341071d2006-06-04 07:24:481360<p>
Junio C Hamanoee3adc32011-04-06 19:53:381361 A ref followed by the suffix <em>@</em> with an ordinal specification
1362 enclosed in a brace pair (e.g. <em>{1}</em>, <em>{15}</em>) specifies
Junio C Hamano2d47c622007-01-18 06:24:101363 the n-th prior value of that ref. For example <em>master@{1}</em>
1364 is the immediate prior value of <em>master</em> while <em>master@{5}</em>
1365 is the 5th prior value of <em>master</em>. This suffix may only be used
1366 immediately following a ref name and the ref must have an existing
Junio C Hamanoee3adc32011-04-06 19:53:381367 log (<em>$GIT_DIR/logs/&lt;refname&gt;</em>).
Junio C Hamano2d47c622007-01-18 06:24:101368</p>
Junio C Hamanoee3adc32011-04-06 19:53:381369</dd>
1370<dt class="hdlist1">
1371<em>@{&lt;n&gt;}</em>, e.g. <em>@{1}</em>
1372</dt>
1373<dd>
Junio C Hamano2d47c622007-01-18 06:24:101374<p>
Junio C Hamanoee3adc32011-04-06 19:53:381375 You can use the <em>@</em> construct with an empty ref part to get at a
1376 reflog entry of the current branch. For example, if you are on
1377 branch <em>blabla</em> then <em>@{1}</em> means the same as <em>blabla@{1}</em>.
Junio C Hamano39381a72007-02-02 07:35:151378</p>
Junio C Hamanoee3adc32011-04-06 19:53:381379</dd>
1380<dt class="hdlist1">
1381<em>@{-&lt;n&gt;}</em>, e.g. <em>@{-1}</em>
1382</dt>
1383<dd>
Junio C Hamano39381a72007-02-02 07:35:151384<p>
Junio C Hamanoc5bd79e2014-01-27 21:31:261385 The construct <em>@{-&lt;n&gt;}</em> means the &lt;n&gt;th branch/commit checked out
Junio C Hamano440791e2009-01-29 01:54:021386 before the current one.
1387</p>
Junio C Hamanoee3adc32011-04-06 19:53:381388</dd>
1389<dt class="hdlist1">
Junio C Hamanofa156ea2013-03-17 23:39:091390<em>&lt;branchname&gt;@{upstream}</em>, e.g. <em>master@{upstream}</em>, <em>@{u}</em>
Junio C Hamanoee3adc32011-04-06 19:53:381391</dt>
1392<dd>
Junio C Hamano440791e2009-01-29 01:54:021393<p>
Junio C Hamanofa156ea2013-03-17 23:39:091394 The suffix <em>@{upstream}</em> to a branchname (short form <em>&lt;branchname&gt;@{u}</em>)
1395 refers to the branch that the branch specified by branchname is set to build on
Junio C Hamano00b9f1a2014-09-29 23:11:281396 top of (configured with <code>branch.&lt;name&gt;.remote</code> and
1397 <code>branch.&lt;name&gt;.merge</code>). A missing branchname defaults to the
Junio C Hamanoe1aeb5e2014-06-06 19:16:291398 current one.
Junio C Hamano57827fb2010-01-23 03:02:501399</p>
Junio C Hamanoee3adc32011-04-06 19:53:381400</dd>
1401<dt class="hdlist1">
Junio C Hamano975f4db2015-06-05 20:28:291402<em>&lt;branchname&gt;@{push}</em>, e.g. <em>master@{push}</em>, <em>@{push}</em>
1403</dt>
1404<dd>
1405<p>
1406 The suffix <em>@{push}</em> reports the branch "where we would push to" if
1407 <code>git push</code> were run while <code>branchname</code> was checked out (or the current
1408 <em>HEAD</em> if no branchname is specified). Since our push destination is
1409 in a remote repository, of course, we report the local tracking branch
1410 that corresponds to that branch (i.e., something in <em>refs/remotes/</em>).
1411</p>
1412<div class="paragraph"><p>Here&#8217;s an example to make it more clear:</p></div>
1413<div class="listingblock">
1414<div class="content">
1415<pre><code>$ git config push.default current
1416$ git config remote.pushdefault myfork
1417$ git checkout -b mybranch origin/master
1418
1419$ git rev-parse --symbolic-full-name @{upstream}
1420refs/remotes/origin/master
1421
1422$ git rev-parse --symbolic-full-name @{push}
1423refs/remotes/myfork/mybranch</code></pre>
1424</div></div>
1425<div class="paragraph"><p>Note in the example that we set up a triangular workflow, where we pull
1426from one location and push to another. In a non-triangular workflow,
1427<em>@{push}</em> is the same as <em>@{upstream}</em>, and there is no need for it.</p></div>
1428</dd>
1429<dt class="hdlist1">
Junio C Hamanoee3adc32011-04-06 19:53:381430<em>&lt;rev&gt;&#94;</em>, e.g. <em>HEAD&#94;, v1.5.1&#94;0</em>
1431</dt>
1432<dd>
Junio C Hamano57827fb2010-01-23 03:02:501433<p>
Junio C Hamanoee3adc32011-04-06 19:53:381434 A suffix <em>&#94;</em> to a revision parameter means the first parent of
Junio C Hamano6926bef2007-06-16 09:54:051435 that commit object. <em>&#94;&lt;n&gt;</em> means the &lt;n&gt;th parent (i.e.
Junio C Hamanoee3adc32011-04-06 19:53:381436 <em>&lt;rev&gt;&#94;</em>
1437 is equivalent to <em>&lt;rev&gt;&#94;1</em>). As a special rule,
1438 <em>&lt;rev&gt;&#94;0</em> means the commit itself and is used when <em>&lt;rev&gt;</em> is the
Junio C Hamano1a4e8412005-12-27 08:17:231439 object name of a tag object that refers to a commit object.
1440</p>
Junio C Hamanoee3adc32011-04-06 19:53:381441</dd>
1442<dt class="hdlist1">
1443<em>&lt;rev&gt;&#126;&lt;n&gt;</em>, e.g. <em>master&#126;3</em>
1444</dt>
1445<dd>
Junio C Hamano1a4e8412005-12-27 08:17:231446<p>
Junio C Hamanoee3adc32011-04-06 19:53:381447 A suffix <em>&#126;&lt;n&gt;</em> to a revision parameter means the commit
Junio C Hamano81d540a2012-03-02 19:52:471448 object that is the &lt;n&gt;th generation ancestor of the named
Junio C Hamanoee3adc32011-04-06 19:53:381449 commit object, following only the first parents. I.e. <em>&lt;rev&gt;&#126;3</em> is
1450 equivalent to <em>&lt;rev&gt;&#94;&#94;&#94;</em> which is equivalent to
1451 <em>&lt;rev&gt;&#94;1&#94;1&#94;1</em>. See below for an illustration of
Junio C Hamano29f14312006-10-26 08:47:291452 the usage of this form.
Junio C Hamano1a4e8412005-12-27 08:17:231453</p>
Junio C Hamanoee3adc32011-04-06 19:53:381454</dd>
1455<dt class="hdlist1">
1456<em>&lt;rev&gt;&#94;{&lt;type&gt;}</em>, e.g. <em>v0.99.8&#94;{commit}</em>
1457</dt>
1458<dd>
Junio C Hamano1a4e8412005-12-27 08:17:231459<p>
Junio C Hamanoee3adc32011-04-06 19:53:381460 A suffix <em>&#94;</em> followed by an object type name enclosed in
Junio C Hamanoe6f28d02013-09-17 21:34:001461 brace pair means dereference the object at <em>&lt;rev&gt;</em> recursively until
1462 an object of type <em>&lt;type&gt;</em> is found or the object cannot be
1463 dereferenced anymore (in which case, barf).
1464 For example, if <em>&lt;rev&gt;</em> is a commit-ish, <em>&lt;rev&gt;&#94;{commit}</em>
1465 describes the corresponding commit object.
1466 Similarly, if <em>&lt;rev&gt;</em> is a tree-ish, <em>&lt;rev&gt;&#94;{tree}</em>
1467 describes the corresponding tree object.
1468 <em>&lt;rev&gt;&#94;0</em>
Junio C Hamanoee3adc32011-04-06 19:53:381469 is a short-hand for <em>&lt;rev&gt;&#94;{commit}</em>.
Junio C Hamano1a4e8412005-12-27 08:17:231470</p>
Junio C Hamanoa6c69e12013-04-03 20:31:101471<div class="paragraph"><p><em>rev&#94;{object}</em> can be used to make sure <em>rev</em> names an
1472object that exists, without requiring <em>rev</em> to be a tag, and
1473without dereferencing <em>rev</em>; because a tag is already an object,
1474it does not have to be dereferenced even once to get to an object.</p></div>
Junio C Hamano79f4c7c2013-09-20 21:03:371475<div class="paragraph"><p><em>rev&#94;{tag}</em> can be used to ensure that <em>rev</em> identifies an
1476existing tag object.</p></div>
Junio C Hamanoee3adc32011-04-06 19:53:381477</dd>
1478<dt class="hdlist1">
1479<em>&lt;rev&gt;&#94;{}</em>, e.g. <em>v0.99.8&#94;{}</em>
1480</dt>
1481<dd>
Junio C Hamano1a4e8412005-12-27 08:17:231482<p>
Junio C Hamanoee3adc32011-04-06 19:53:381483 A suffix <em>&#94;</em> followed by an empty brace pair
1484 means the object could be a tag,
Junio C Hamano1a4e8412005-12-27 08:17:231485 and dereference the tag recursively until a non-tag object is
1486 found.
1487</p>
Junio C Hamanoee3adc32011-04-06 19:53:381488</dd>
1489<dt class="hdlist1">
1490<em>&lt;rev&gt;&#94;{/&lt;text&gt;}</em>, e.g. <em>HEAD^{/fix nasty bug}</em>
1491</dt>
1492<dd>
Junio C Hamanofbe00522006-10-19 05:58:481493<p>
Junio C Hamanoee3adc32011-04-06 19:53:381494 A suffix <em>&#94;</em> to a revision parameter, followed by a brace
1495 pair that contains a text led by a slash,
1496 is the same as the <em>:/fix nasty bug</em> syntax below except that
Junio C Hamano18b5ad52010-12-22 01:57:501497 it returns the youngest matching commit which is reachable from
Junio C Hamanoee3adc32011-04-06 19:53:381498 the <em>&lt;rev&gt;</em> before <em>&#94;</em>.
Junio C Hamano18b5ad52010-12-22 01:57:501499</p>
Junio C Hamanoee3adc32011-04-06 19:53:381500</dd>
1501<dt class="hdlist1">
1502<em>:/&lt;text&gt;</em>, e.g. <em>:/fix nasty bug</em>
1503</dt>
1504<dd>
Junio C Hamano18b5ad52010-12-22 01:57:501505<p>
Junio C Hamanoee3adc32011-04-06 19:53:381506 A colon, followed by a slash, followed by a text, names
Junio C Hamano442206c2010-09-28 05:51:231507 a commit whose commit message matches the specified regular expression.
Junio C Hamano6ac2f142007-03-01 01:24:561508 This name returns the youngest matching commit which is
Junio C Hamano9099a7c2016-02-10 23:42:051509 reachable from any ref. The regular expression can match any part of the
1510 commit message. To match messages starting with a string, one can use
1511 e.g. <em>:/^foo</em>. The special sequence <em>:/!</em> is reserved for modifiers to what
1512 is matched. <em>:/!-foo</em> performs a negative match, while <em>:/!!foo</em> matches a
1513 literal <em>!</em> character, followed by <em>foo</em>. Any other sequence beginning with
1514 <em>:/!</em> is reserved for now.
Junio C Hamano6ac2f142007-03-01 01:24:561515</p>
Junio C Hamanoee3adc32011-04-06 19:53:381516</dd>
1517<dt class="hdlist1">
1518<em>&lt;rev&gt;:&lt;path&gt;</em>, e.g. <em>HEAD:README</em>, <em>:README</em>, <em>master:./README</em>
1519</dt>
1520<dd>
Junio C Hamano6ac2f142007-03-01 01:24:561521<p>
Junio C Hamanoee3adc32011-04-06 19:53:381522 A suffix <em>:</em> followed by a path names the blob or tree
Junio C Hamanofbe00522006-10-19 05:58:481523 at the given path in the tree-ish object named by the part
1524 before the colon.
Junio C Hamanoee3adc32011-04-06 19:53:381525 <em>:path</em> (with an empty part before the colon)
Junio C Hamano7d449522010-07-01 00:08:511526 is a special case of the syntax described next: content
1527 recorded in the index at the given path.
Junio C Hamanoee3adc32011-04-06 19:53:381528 A path starting with <em>./</em> or <em>../</em> is relative to the current working directory.
1529 The given path will be converted to be relative to the working tree&#8217;s root directory.
Junio C Hamano0d75e872010-12-17 06:57:261530 This is most useful to address a blob or tree from a commit or tree that has
Junio C Hamanoee3adc32011-04-06 19:53:381531 the same tree structure as the working tree.
Junio C Hamanofbe00522006-10-19 05:58:481532</p>
Junio C Hamanoee3adc32011-04-06 19:53:381533</dd>
1534<dt class="hdlist1">
1535<em>:&lt;n&gt;:&lt;path&gt;</em>, e.g. <em>:0:README</em>, <em>:README</em>
1536</dt>
1537<dd>
Junio C Hamanofbe00522006-10-19 05:58:481538<p>
Junio C Hamanoee3adc32011-04-06 19:53:381539 A colon, optionally followed by a stage number (0 to 3) and a
1540 colon, followed by a path, names a blob object in the
1541 index at the given path. A missing stage number (and the colon
1542 that follows it) names a stage 0 entry. During a merge, stage
Junio C Hamano68cf15a2010-11-06 01:01:591543 1 is the common ancestor, stage 2 is the target branch&#8217;s version
Junio C Hamanocae86272007-08-21 02:20:491544 (typically the current branch), and stage 3 is the version from
Junio C Hamanoee3adc32011-04-06 19:53:381545 the branch which is being merged.
Junio C Hamanofbe00522006-10-19 05:58:481546</p>
Junio C Hamanoee3adc32011-04-06 19:53:381547</dd>
1548</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591549<div class="paragraph"><p>Here is an illustration, by Jon Loeliger. Both commit nodes B
Junio C Hamano1c95e9d2008-02-01 10:52:441550and C are parents of commit node A. Parent commits are ordered
Junio C Hamanoba4b9282008-07-06 05:20:311551left-to-right.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231552<div class="literalblock">
1553<div class="content">
Junio C Hamano00b9f1a2014-09-29 23:11:281554<pre><code>G H I J
Junio C Hamano1a4e8412005-12-27 08:17:231555 \ / \ /
1556 D E F
Junio C Hamano137273f2008-05-27 07:44:331557 \ | / \
1558 \ | / |
Junio C Hamano872c5682006-07-07 06:05:401559 \|/ |
Junio C Hamano1a4e8412005-12-27 08:17:231560 B C
1561 \ /
1562 \ /
Junio C Hamano00b9f1a2014-09-29 23:11:281563 A</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:231564</div></div>
1565<div class="literalblock">
1566<div class="content">
Junio C Hamano00b9f1a2014-09-29 23:11:281567<pre><code>A = = A^0
Junio C Hamano1a4e8412005-12-27 08:17:231568B = A^ = A^1 = A~1
1569C = A^2 = A^2
1570D = A^^ = A^1^1 = A~2
1571E = B^2 = A^^2
1572F = B^3 = A^^3
1573G = A^^^ = A^1^1^1 = A~3
1574H = D^2 = B^^2 = A^^^2 = A~2^2
1575I = F^ = B^3^ = A^^3^
Junio C Hamano00b9f1a2014-09-29 23:11:281576J = F^2 = B^3^2 = A^^3^2</code></pre>
Junio C Hamano1a4e8412005-12-27 08:17:231577</div></div>
1578</div>
Junio C Hamano9d971152012-12-19 00:43:111579</div>
1580<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311581<h2 id="_specifying_ranges">SPECIFYING RANGES</h2>
Junio C Hamano872c5682006-07-07 06:05:401582<div class="sectionbody">
Junio C Hamano00b9f1a2014-09-29 23:11:281583<div class="paragraph"><p>History traversing commands such as <code>git log</code> operate on a set
Junio C Hamano872c5682006-07-07 06:05:401584of commits, not just a single commit. To these commands,
1585specifying a single revision with the notation described in the
1586previous section means the set of commits reachable from that
Junio C Hamanoba4b9282008-07-06 05:20:311587commit, following the commit ancestry chain.</p></div>
Junio C Hamanoee3adc32011-04-06 19:53:381588<div class="paragraph"><p>To exclude commits reachable from a commit, a prefix <em>&#94;</em>
1589notation is used. E.g. <em>&#94;r1 r2</em> means commits reachable
1590from <em>r2</em> but exclude the ones reachable from <em>r1</em>.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591591<div class="paragraph"><p>This set operation appears so often that there is a shorthand
Junio C Hamanoee3adc32011-04-06 19:53:381592for it. When you have two commits <em>r1</em> and <em>r2</em> (named according
Junio C Hamanod32738e2008-07-09 19:53:421593to the syntax explained in SPECIFYING REVISIONS above), you can ask
1594for commits that are reachable from r2 excluding those that are reachable
Junio C Hamanoee3adc32011-04-06 19:53:381595from r1 by <em>&#94;r1 r2</em> and it can be written as <em>r1..r2</em>.</p></div>
1596<div class="paragraph"><p>A similar notation <em>r1...r2</em> is called symmetric difference
1597of <em>r1</em> and <em>r2</em> and is defined as
1598<em>r1 r2 --not $(git merge-base --all r1 r2)</em>.
Junio C Hamanoea5dae62007-05-10 23:25:081599It is the set of commits that are reachable from either one of
Junio C Hamanoee3adc32011-04-06 19:53:381600<em>r1</em> or <em>r2</em> but not from both.</p></div>
Junio C Hamanoeccdd4a2012-09-10 23:28:171601<div class="paragraph"><p>In these two shorthands, you can omit one end and let it default to HEAD.
1602For example, <em>origin..</em> is a shorthand for <em>origin..HEAD</em> and asks "What
1603did I do since I forked from the origin branch?" Similarly, <em>..origin</em>
1604is a shorthand for <em>HEAD..origin</em> and asks "What did the origin do since
1605I forked from them?" Note that <em>..</em> would mean <em>HEAD..HEAD</em> which is an
1606empty range that is both reachable and unreachable from HEAD.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591607<div class="paragraph"><p>Two other shorthands for naming a set that is formed by a commit
Junio C Hamanoee3adc32011-04-06 19:53:381608and its parent commits exist. The <em>r1&#94;@</em> notation means all
1609parents of <em>r1</em>. <em>r1&#94;!</em> includes commit <em>r1</em> but excludes
Junio C Hamano15048272008-07-07 22:10:481610all of its parents.</p></div>
Junio C Hamanof5933722012-07-25 23:25:211611<div class="paragraph"><p>To summarize:</p></div>
1612<div class="dlist"><dl>
1613<dt class="hdlist1">
1614<em>&lt;rev&gt;</em>
1615</dt>
1616<dd>
1617<p>
1618 Include commits that are reachable from (i.e. ancestors of)
1619 &lt;rev&gt;.
1620</p>
1621</dd>
1622<dt class="hdlist1">
1623<em>&#94;&lt;rev&gt;</em>
1624</dt>
1625<dd>
1626<p>
1627 Exclude commits that are reachable from (i.e. ancestors of)
1628 &lt;rev&gt;.
1629</p>
1630</dd>
1631<dt class="hdlist1">
1632<em>&lt;rev1&gt;..&lt;rev2&gt;</em>
1633</dt>
1634<dd>
1635<p>
1636 Include commits that are reachable from &lt;rev2&gt; but exclude
Junio C Hamanof26c77e2013-04-27 00:06:041637 those that are reachable from &lt;rev1&gt;. When either &lt;rev1&gt; or
1638 &lt;rev2&gt; is omitted, it defaults to <em>HEAD</em>.
Junio C Hamanof5933722012-07-25 23:25:211639</p>
1640</dd>
1641<dt class="hdlist1">
1642<em>&lt;rev1&gt;...&lt;rev2&gt;</em>
1643</dt>
1644<dd>
1645<p>
1646 Include commits that are reachable from either &lt;rev1&gt; or
Junio C Hamanof26c77e2013-04-27 00:06:041647 &lt;rev2&gt; but exclude those that are reachable from both. When
1648 either &lt;rev1&gt; or &lt;rev2&gt; is omitted, it defaults to <em>HEAD</em>.
Junio C Hamanof5933722012-07-25 23:25:211649</p>
1650</dd>
1651<dt class="hdlist1">
1652<em>&lt;rev&gt;&#94;@</em>, e.g. <em>HEAD&#94;@</em>
1653</dt>
1654<dd>
1655<p>
1656 A suffix <em>&#94;</em> followed by an at sign is the same as listing
1657 all parents of <em>&lt;rev&gt;</em> (meaning, include anything reachable from
1658 its parents, but not the commit itself).
1659</p>
1660</dd>
1661<dt class="hdlist1">
1662<em>&lt;rev&gt;&#94;!</em>, e.g. <em>HEAD&#94;!</em>
1663</dt>
1664<dd>
1665<p>
1666 A suffix <em>&#94;</em> followed by an exclamation mark is the same
1667 as giving commit <em>&lt;rev&gt;</em> and then all its parents prefixed with
1668 <em>&#94;</em> to exclude them (and their ancestors).
1669</p>
1670</dd>
1671</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591672<div class="paragraph"><p>Here are a handful of examples:</p></div>
Junio C Hamano872c5682006-07-07 06:05:401673<div class="literalblock">
1674<div class="content">
Junio C Hamano00b9f1a2014-09-29 23:11:281675<pre><code>D G H D
Junio C Hamano3aa81822007-03-30 08:52:261676D F G H I J D F
1677^G D H D
1678^D B E I J F B
Junio C Hamanof5933722012-07-25 23:25:211679B..C C
Junio C Hamano3aa81822007-03-30 08:52:261680B...C G H D E B C
1681^D B C E I J F B C
Junio C Hamanof5933722012-07-25 23:25:211682C I J F C
Junio C Hamano3aa81822007-03-30 08:52:261683C^@ I J F
Junio C Hamanof5933722012-07-25 23:25:211684C^! C
Junio C Hamano00b9f1a2014-09-29 23:11:281685F^! D G H D F</code></pre>
Junio C Hamano872c5682006-07-07 06:05:401686</div></div>
1687</div>
Junio C Hamano9d971152012-12-19 00:43:111688</div>
1689<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311690<h2 id="_parseopt">PARSEOPT</h2>
Junio C Hamanoe1258662007-11-19 05:03:191691<div class="sectionbody">
Junio C Hamano00b9f1a2014-09-29 23:11:281692<div class="paragraph"><p>In <code>--parseopt</code> mode, <em>git rev-parse</em> helps massaging options to bring to shell
Junio C Hamanoe1258662007-11-19 05:03:191693scripts the same facilities C builtins have. It works as an option normalizer
Junio C Hamano00b9f1a2014-09-29 23:11:281694(e.g. splits single switches aggregate values), a bit like <code>getopt(1)</code> does.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591695<div class="paragraph"><p>It takes on the standard input the specification of the options to parse and
Junio C Hamano00b9f1a2014-09-29 23:11:281696understand, and echoes on the standard output a string suitable for <code>sh(1)</code> <code>eval</code>
Junio C Hamanoe1258662007-11-19 05:03:191697to replace the arguments with normalized ones. In case of error, it outputs
Junio C Hamanoba4b9282008-07-06 05:20:311698usage on the standard error stream, and exits with code 129.</p></div>
Junio C Hamano00b9f1a2014-09-29 23:11:281699<div class="paragraph"><p>Note: Make sure you quote the result when passing it to <code>eval</code>. See
Junio C Hamanoa9788762010-08-03 15:15:541700below for an example.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111701<div class="sect2">
1702<h3 id="_input_format">Input Format</h3>
Junio C Hamano68cf15a2010-11-06 01:01:591703<div class="paragraph"><p><em>git rev-parse --parseopt</em> input format is fully text based. It has two parts,
Junio C Hamano00b9f1a2014-09-29 23:11:281704separated by a line that contains only <code>--</code>. The lines before the separator
Junio C Hamano52b6ba32014-04-01 00:26:481705(should be one or more) are used for the usage.
Junio C Hamanoba4b9282008-07-06 05:20:311706The lines after the separator describe the options.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591707<div class="paragraph"><p>Each line of options has this format:</p></div>
Junio C Hamanoe1258662007-11-19 05:03:191708<div class="listingblock">
1709<div class="content">
Junio C Hamano00b9f1a2014-09-29 23:11:281710<pre><code>&lt;opt-spec&gt;&lt;flags&gt;*&lt;arg-hint&gt;? SP+ help LF</code></pre>
Junio C Hamanoe1258662007-11-19 05:03:191711</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591712<div class="dlist"><dl>
1713<dt class="hdlist1">
Junio C Hamano00b9f1a2014-09-29 23:11:281714<code>&lt;opt-spec&gt;</code>
Junio C Hamanoe1258662007-11-19 05:03:191715</dt>
1716<dd>
1717<p>
1718 its format is the short option character, then the long option name
1719 separated by a comma. Both parts are not required, though at least one
Junio C Hamanod7ed4042015-08-03 19:43:001720 is necessary. May not contain any of the <code>&lt;flags&gt;</code> characters.
1721 <code>h,help</code>, <code>dry-run</code> and <code>f</code> are examples of correct <code>&lt;opt-spec&gt;</code>.
Junio C Hamanoe1258662007-11-19 05:03:191722</p>
1723</dd>
Junio C Hamano68cf15a2010-11-06 01:01:591724<dt class="hdlist1">
Junio C Hamano00b9f1a2014-09-29 23:11:281725<code>&lt;flags&gt;</code>
Junio C Hamanoe1258662007-11-19 05:03:191726</dt>
1727<dd>
1728<p>
Junio C Hamano00b9f1a2014-09-29 23:11:281729 <code>&lt;flags&gt;</code> are of <code>*</code>, <code>=</code>, <code>?</code> or <code>!</code>.
Junio C Hamanoe1258662007-11-19 05:03:191730</p>
Junio C Hamano68cf15a2010-11-06 01:01:591731<div class="ulist"><ul>
Junio C Hamanobb343172008-03-09 10:39:091732<li>
1733<p>
Junio C Hamano00b9f1a2014-09-29 23:11:281734Use <code>=</code> if the option takes an argument.
Junio C Hamanobb343172008-03-09 10:39:091735</p>
1736</li>
1737<li>
1738<p>
Junio C Hamano00b9f1a2014-09-29 23:11:281739Use <code>?</code> to mean that the option takes an optional argument. You
1740 probably want to use the <code>--stuck-long</code> mode to be able to
Junio C Hamanof079f702013-12-06 23:43:181741 unambiguously parse the optional argument.
Junio C Hamanobb343172008-03-09 10:39:091742</p>
1743</li>
1744<li>
1745<p>
Junio C Hamano00b9f1a2014-09-29 23:11:281746Use <code>*</code> to mean that this option should not be listed in the usage
1747 generated for the <code>-h</code> argument. It&#8217;s shown for <code>--help-all</code> as
Junio C Hamanoa28a9202012-06-21 07:08:231748 documented in <a href="gitcli.html">gitcli(7)</a>.
Junio C Hamanobb343172008-03-09 10:39:091749</p>
1750</li>
1751<li>
1752<p>
Junio C Hamano00b9f1a2014-09-29 23:11:281753Use <code>!</code> to not make the corresponding negated long option available.
Junio C Hamanobb343172008-03-09 10:39:091754</p>
1755</li>
Junio C Hamanoba4b9282008-07-06 05:20:311756</ul></div>
Junio C Hamanoe1258662007-11-19 05:03:191757</dd>
Junio C Hamano52b6ba32014-04-01 00:26:481758<dt class="hdlist1">
Junio C Hamano00b9f1a2014-09-29 23:11:281759<code>&lt;arg-hint&gt;</code>
Junio C Hamano52b6ba32014-04-01 00:26:481760</dt>
1761<dd>
1762<p>
Junio C Hamano00b9f1a2014-09-29 23:11:281763 <code>&lt;arg-hint&gt;</code>, if specified, is used as a name of the argument in the
1764 help output, for options that take arguments. <code>&lt;arg-hint&gt;</code> is
Junio C Hamanod75148a2014-04-08 19:48:381765 terminated by the first whitespace. It is customary to use a
1766 dash to separate words in a multi-word argument hint.
Junio C Hamano52b6ba32014-04-01 00:26:481767</p>
1768</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311769</dl></div>
Junio C Hamano68cf15a2010-11-06 01:01:591770<div class="paragraph"><p>The remainder of the line, after stripping the spaces, is used
Junio C Hamanoba4b9282008-07-06 05:20:311771as the help associated to the option.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591772<div class="paragraph"><p>Blank lines are ignored, and lines that don&#8217;t match this specification are used
Junio C Hamanoe1258662007-11-19 05:03:191773as option group headers (start the line with a space to create such
Junio C Hamanoba4b9282008-07-06 05:20:311774lines on purpose).</p></div>
Junio C Hamano9d971152012-12-19 00:43:111775</div>
1776<div class="sect2">
1777<h3 id="_example">Example</h3>
Junio C Hamanoe1258662007-11-19 05:03:191778<div class="listingblock">
1779<div class="content">
Junio C Hamano00b9f1a2014-09-29 23:11:281780<pre><code>OPTS_SPEC="\
Junio C Hamanoe1258662007-11-19 05:03:191781some-command [options] &lt;args&gt;...
1782
1783some-command does foo and bar!
1784--
1785h,help show the help
1786
1787foo some nifty option --foo
1788bar= some cool option --bar with an argument
Junio C Hamano52b6ba32014-04-01 00:26:481789baz=arg another cool option --baz with a named argument
1790qux?path qux may take a path argument but has meaning by itself
Junio C Hamanoe1258662007-11-19 05:03:191791
1792 An option group Header
1793C? option C with an optional argument"
1794
Junio C Hamano00b9f1a2014-09-29 23:11:281795eval "$(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)"</code></pre>
Junio C Hamanoe1258662007-11-19 05:03:191796</div></div>
1797</div>
Junio C Hamano52b6ba32014-04-01 00:26:481798<div class="sect2">
1799<h3 id="_usage_text">Usage text</h3>
Junio C Hamano00b9f1a2014-09-29 23:11:281800<div class="paragraph"><p>When <code>"$@"</code> is <code>-h</code> or <code>--help</code> in the above example, the following
Junio C Hamano52b6ba32014-04-01 00:26:481801usage text would be shown:</p></div>
1802<div class="listingblock">
1803<div class="content">
Junio C Hamano00b9f1a2014-09-29 23:11:281804<pre><code>usage: some-command [options] &lt;args&gt;...
Junio C Hamano52b6ba32014-04-01 00:26:481805
1806 some-command does foo and bar!
1807
1808 -h, --help show the help
1809 --foo some nifty option --foo
1810 --bar ... some cool option --bar with an argument
Junio C Hamanod75148a2014-04-08 19:48:381811 --baz &lt;arg&gt; another cool option --baz with a named argument
Junio C Hamano52b6ba32014-04-01 00:26:481812 --qux[=&lt;path&gt;] qux may take a path argument but has meaning by itself
1813
1814An option group Header
Junio C Hamano00b9f1a2014-09-29 23:11:281815 -C[...] option C with an optional argument</code></pre>
Junio C Hamano52b6ba32014-04-01 00:26:481816</div></div>
1817</div>
Junio C Hamano9d971152012-12-19 00:43:111818</div>
1819</div>
1820<div class="sect1">
Junio C Hamano7ae18252009-05-23 09:53:321821<h2 id="_sq_quote">SQ-QUOTE</h2>
1822<div class="sectionbody">
Junio C Hamano00b9f1a2014-09-29 23:11:281823<div class="paragraph"><p>In <code>--sq-quote</code> mode, <em>git rev-parse</em> echoes on the standard output a
1824single line suitable for <code>sh(1)</code> <code>eval</code>. This line is made by
1825normalizing the arguments following <code>--sq-quote</code>. Nothing other than
Junio C Hamano7ae18252009-05-23 09:53:321826quoting the arguments is done.</p></div>
Junio C Hamano68cf15a2010-11-06 01:01:591827<div class="paragraph"><p>If you want command input to still be interpreted as usual by
Junio C Hamano00b9f1a2014-09-29 23:11:281828<em>git rev-parse</em> before the output is shell quoted, see the <code>--sq</code>
Junio C Hamano7ae18252009-05-23 09:53:321829option.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111830<div class="sect2">
1831<h3 id="_example_2">Example</h3>
Junio C Hamano7ae18252009-05-23 09:53:321832<div class="listingblock">
1833<div class="content">
Junio C Hamano00b9f1a2014-09-29 23:11:281834<pre><code>$ cat &gt;your-git-script.sh &lt;&lt;\EOF
Junio C Hamano7ae18252009-05-23 09:53:321835#!/bin/sh
1836args=$(git rev-parse --sq-quote "$@") # quote user-supplied arguments
1837command="git frotz -n24 $args" # and use it inside a handcrafted
1838 # command line
1839eval "$command"
1840EOF
1841
Junio C Hamano00b9f1a2014-09-29 23:11:281842$ sh your-git-script.sh "a b'c"</code></pre>
Junio C Hamano7ae18252009-05-23 09:53:321843</div></div>
1844</div>
Junio C Hamano9d971152012-12-19 00:43:111845</div>
1846</div>
1847<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311848<h2 id="_examples">EXAMPLES</h2>
Junio C Hamanofeeb1be2008-05-22 00:53:351849<div class="sectionbody">
Junio C Hamano68cf15a2010-11-06 01:01:591850<div class="ulist"><ul>
Junio C Hamanofeeb1be2008-05-22 00:53:351851<li>
1852<p>
1853Print the object name of the current commit:
1854</p>
1855<div class="listingblock">
1856<div class="content">
Junio C Hamano00b9f1a2014-09-29 23:11:281857<pre><code>$ git rev-parse --verify HEAD</code></pre>
Junio C Hamanofeeb1be2008-05-22 00:53:351858</div></div>
1859</li>
1860<li>
1861<p>
1862Print the commit object name from the revision in the $REV shell variable:
1863</p>
1864<div class="listingblock">
1865<div class="content">
Junio C Hamano00b9f1a2014-09-29 23:11:281866<pre><code>$ git rev-parse --verify $REV^{commit}</code></pre>
Junio C Hamanofeeb1be2008-05-22 00:53:351867</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591868<div class="paragraph"><p>This will error out if $REV is empty or not a valid revision.</p></div>
Junio C Hamanofeeb1be2008-05-22 00:53:351869</li>
1870<li>
1871<p>
Junio C Hamanoedf80bd2013-04-05 22:14:361872Similar to above:
Junio C Hamanofeeb1be2008-05-22 00:53:351873</p>
1874<div class="listingblock">
1875<div class="content">
Junio C Hamano00b9f1a2014-09-29 23:11:281876<pre><code>$ git rev-parse --default master --verify $REV</code></pre>
Junio C Hamanofeeb1be2008-05-22 00:53:351877</div></div>
Junio C Hamano68cf15a2010-11-06 01:01:591878<div class="paragraph"><p>but if $REV is empty, the commit object name from master will be printed.</p></div>
Junio C Hamanofeeb1be2008-05-22 00:53:351879</li>
Junio C Hamanoba4b9282008-07-06 05:20:311880</ul></div>
Junio C Hamanofeeb1be2008-05-22 00:53:351881</div>
Junio C Hamano9d971152012-12-19 00:43:111882</div>
1883<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311884<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231885<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231886<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231887</div>
Junio C Hamano7bd050f2011-09-22 06:32:221888</div>
Junio C Hamano9d971152012-12-19 00:43:111889</div>
Junio C Hamano7bd050f2011-09-22 06:32:221890<div id="footnotes"><hr /></div>
Junio C Hamano1a4e8412005-12-27 08:17:231891<div id="footer">
1892<div id="footer-text">
Junio C Hamanod7ed4042015-08-03 19:43:001893Last updated 2015-08-03 12:41:59 PDT
Junio C Hamano1a4e8412005-12-27 08:17:231894</div>
1895</div>
1896</body>
1897</html>