Autogenerated HTML docs for v1.2.2-g858c
[git.git] / git-rev-parse.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"\r
2     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
4 <head>\r
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
6 <meta name="generator" content="AsciiDoc 7.0.2" />\r
7 <style type="text/css">\r
8 /* Debug borders */\r
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {\r
10 /*\r
11   border: 1px solid red;\r
12 */\r
13 }\r
14 \r
15 body {\r
16   margin: 1em 5% 1em 5%;\r
17 }\r
18 \r
19 a { color: blue; }\r
20 a:visited { color: fuchsia; }\r
21 \r
22 em {\r
23   font-style: italic;\r
24 }\r
25 \r
26 strong {\r
27   font-weight: bold;\r
28 }\r
29 \r
30 tt {\r
31   color: navy;\r
32 }\r
33 \r
34 h1, h2, h3, h4, h5, h6 {\r
35   color: #527bbd;\r
36   font-family: sans-serif;\r
37   margin-top: 1.2em;\r
38   margin-bottom: 0.5em;\r
39   line-height: 1.3;\r
40 }\r
41 \r
42 h1 {\r
43   border-bottom: 2px solid silver;\r
44 }\r
45 h2 {\r
46   border-bottom: 2px solid silver;\r
47   padding-top: 0.5em;\r
48 }\r
49 \r
50 div.sectionbody {\r
51   font-family: serif;\r
52   margin-left: 0;\r
53 }\r
54 \r
55 hr {\r
56   border: 1px solid silver;\r
57 }\r
58 \r
59 p {\r
60   margin-top: 0.5em;\r
61   margin-bottom: 0.5em;\r
62 }\r
63 \r
64 pre {\r
65   padding: 0;\r
66   margin: 0;\r
67 }\r
68 \r
69 span#author {\r
70   color: #527bbd;\r
71   font-family: sans-serif;\r
72   font-weight: bold;\r
73   font-size: 1.2em;\r
74 }\r
75 span#email {\r
76 }\r
77 span#revision {\r
78   font-family: sans-serif;\r
79 }\r
80 \r
81 div#footer {\r
82   font-family: sans-serif;\r
83   font-size: small;\r
84   border-top: 2px solid silver;\r
85   padding-top: 0.5em;\r
86   margin-top: 4.0em;\r
87 }\r
88 div#footer-text {\r
89   float: left;\r
90   padding-bottom: 0.5em;\r
91 }\r
92 div#footer-badges {\r
93   float: right;\r
94   padding-bottom: 0.5em;\r
95 }\r
96 \r
97 div#preamble,\r
98 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,\r
99 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,\r
100 div.admonitionblock {\r
101   margin-right: 10%;\r
102   margin-top: 1.5em;\r
103   margin-bottom: 1.5em;\r
104 }\r
105 div.admonitionblock {\r
106   margin-top: 2.5em;\r
107   margin-bottom: 2.5em;\r
108 }\r
109 \r
110 div.content { /* Block element content. */\r
111   padding: 0;\r
112 }\r
113 \r
114 /* Block element titles. */\r
115 div.title, caption.title {\r
116   font-family: sans-serif;\r
117   font-weight: bold;\r
118   text-align: left;\r
119   margin-top: 1.0em;\r
120   margin-bottom: 0.5em;\r
121 }\r
122 div.title + * {\r
123   margin-top: 0;\r
124 }\r
125 \r
126 td div.title:first-child {\r
127   margin-top: 0.0em;\r
128 }\r
129 div.content div.title:first-child {\r
130   margin-top: 0.0em;\r
131 }\r
132 div.content + div.title {\r
133   margin-top: 0.0em;\r
134 }\r
135 \r
136 div.sidebarblock > div.content {\r
137   background: #ffffee;\r
138   border: 1px solid silver;\r
139   padding: 0.5em;\r
140 }\r
141 \r
142 div.listingblock > div.content {\r
143   border: 1px solid silver;\r
144   background: #f4f4f4;\r
145   padding: 0.5em;\r
146 }\r
147 \r
148 div.quoteblock > div.content {\r
149   padding-left: 2.0em;\r
150 }\r
151 div.quoteblock .attribution {\r
152   text-align: right;\r
153 }\r
154 \r
155 div.admonitionblock .icon {\r
156   vertical-align: top;\r
157   font-size: 1.1em;\r
158   font-weight: bold;\r
159   text-decoration: underline;\r
160   color: #527bbd;\r
161   padding-right: 0.5em;\r
162 }\r
163 div.admonitionblock td.content {\r
164   padding-left: 0.5em;\r
165   border-left: 2px solid silver;\r
166 }\r
167 \r
168 div.exampleblock > div.content {\r
169   border-left: 2px solid silver;\r
170   padding: 0.5em;\r
171 }\r
172 \r
173 div.verseblock div.content {\r
174   white-space: pre;\r
175 }\r
176 \r
177 div.imageblock div.content { padding-left: 0; }\r
178 div.imageblock img { border: 1px solid silver; }\r
179 span.image img { border-style: none; }\r
180 \r
181 dl {\r
182   margin-top: 0.8em;\r
183   margin-bottom: 0.8em;\r
184 }\r
185 dt {\r
186   margin-top: 0.5em;\r
187   margin-bottom: 0;\r
188   font-style: italic;\r
189 }\r
190 dd > *:first-child {\r
191   margin-top: 0;\r
192 }\r
193 \r
194 ul, ol {\r
195     list-style-position: outside;\r
196 }\r
197 ol.olist2 {\r
198   list-style-type: lower-alpha;\r
199 }\r
200 \r
201 div.tableblock > table {\r
202   border-color: #527bbd;\r
203   border-width: 3px;\r
204 }\r
205 thead {\r
206   font-family: sans-serif;\r
207   font-weight: bold;\r
208 }\r
209 tfoot {\r
210   font-weight: bold;\r
211 }\r
212 \r
213 div.hlist {\r
214   margin-top: 0.8em;\r
215   margin-bottom: 0.8em;\r
216 }\r
217 td.hlist1 {\r
218   vertical-align: top;\r
219   font-style: italic;\r
220   padding-right: 0.8em;\r
221 }\r
222 td.hlist2 {\r
223   vertical-align: top;\r
224 }\r
225 \r
226 @media print {\r
227   div#footer-badges { display: none; }\r
228 }\r
229 include::./stylesheets/xhtml11-manpage.css[]\r
230 /* Workarounds for IE6's broken and incomplete CSS2. */\r
231 \r
232 div.sidebar-content {\r
233   background: #ffffee;\r
234   border: 1px solid silver;\r
235   padding: 0.5em;\r
236 }\r
237 div.sidebar-title, div.image-title {\r
238   font-family: sans-serif;\r
239   font-weight: bold;\r
240   margin-top: 0.0em;\r
241   margin-bottom: 0.5em;\r
242 }\r
243 \r
244 div.listingblock div.content {\r
245   border: 1px solid silver;\r
246   background: #f4f4f4;\r
247   padding: 0.5em;\r
248 }\r
249 \r
250 div.quoteblock-content {\r
251   padding-left: 2.0em;\r
252 }\r
253 \r
254 div.exampleblock-content {\r
255   border-left: 2px solid silver;\r
256   padding-left: 0.5em;\r
257 }\r
258 </style>\r
259 <title>git-rev-parse(1)</title>\r
260 </head>\r
261 <body>\r
262 <div id="header">\r
263 <h1>\r
264 git-rev-parse(1) Manual Page\r
265 </h1>\r
266 <h2>NAME</h2>\r
267 <div class="sectionbody">\r
268 <p>git-rev-parse -\r
269    Pick out and massage parameters.\r
270 </p>\r
271 </div>\r
272 </div>\r
273 <h2>SYNOPSIS</h2>\r
274 <div class="sectionbody">\r
275 <p><em>git-rev-parse</em> [ --option ] &lt;args&gt;&#8230;</p>\r
276 </div>\r
277 <h2>DESCRIPTION</h2>\r
278 <div class="sectionbody">\r
279 <p>Many git Porcelainish commands take mixture of flags\r
280 (i.e. parameters that begin with a dash <em>-</em>) and parameters\r
281 meant for underlying <tt>git-rev-list</tt> command they use internally\r
282 and flags and parameters for other commands they use as the\r
283 downstream of <tt>git-rev-list</tt>.  This command is used to\r
284 distinguish between them.</p>\r
285 </div>\r
286 <h2>OPTIONS</h2>\r
287 <div class="sectionbody">\r
288 <dl>\r
289 <dt>\r
290 --revs-only\r
291 </dt>\r
292 <dd>\r
293 <p>\r
294         Do not output flags and parameters not meant for\r
295         <tt>git-rev-list</tt> command.\r
296 </p>\r
297 </dd>\r
298 <dt>\r
299 --no-revs\r
300 </dt>\r
301 <dd>\r
302 <p>\r
303         Do not output flags and parameters meant for\r
304         <tt>git-rev-list</tt> command.\r
305 </p>\r
306 </dd>\r
307 <dt>\r
308 --flags\r
309 </dt>\r
310 <dd>\r
311 <p>\r
312         Do not output non-flag parameters.\r
313 </p>\r
314 </dd>\r
315 <dt>\r
316 --no-flags\r
317 </dt>\r
318 <dd>\r
319 <p>\r
320         Do not output flag parameters.\r
321 </p>\r
322 </dd>\r
323 <dt>\r
324 --default &lt;arg&gt;\r
325 </dt>\r
326 <dd>\r
327 <p>\r
328         If there is no parameter given by the user, use <tt>&lt;arg&gt;</tt>\r
329         instead.\r
330 </p>\r
331 </dd>\r
332 <dt>\r
333 --verify\r
334 </dt>\r
335 <dd>\r
336 <p>\r
337         The parameter given must be usable as a single, valid\r
338         object name.  Otherwise barf and abort.\r
339 </p>\r
340 </dd>\r
341 <dt>\r
342 --sq\r
343 </dt>\r
344 <dd>\r
345 <p>\r
346         Usually the output is made one line per flag and\r
347         parameter.  This option makes output a single line,\r
348         properly quoted for consumption by shell.  Useful when\r
349         you expect your parameter to contain whitespaces and\r
350         newlines (e.g. when using pickaxe <tt>-S</tt> with\r
351         <tt>git-diff-*</tt>).\r
352 </p>\r
353 </dd>\r
354 <dt>\r
355 --not\r
356 </dt>\r
357 <dd>\r
358 <p>\r
359         When showing object names, prefix them with <em>^</em> and\r
360         strip <em>^</em> prefix from the object names that already have\r
361         one.\r
362 </p>\r
363 </dd>\r
364 <dt>\r
365 --symbolic\r
366 </dt>\r
367 <dd>\r
368 <p>\r
369         Usually the object names are output in SHA1 form (with\r
370         possible <em>^</em> prefix); this option makes them output in a\r
371         form as close to the original input as possible.\r
372 </p>\r
373 </dd>\r
374 <dt>\r
375 --all\r
376 </dt>\r
377 <dd>\r
378 <p>\r
379         Show all refs found in <tt>$GIT_DIR/refs</tt>.\r
380 </p>\r
381 </dd>\r
382 <dt>\r
383 --show-prefix\r
384 </dt>\r
385 <dd>\r
386 <p>\r
387         When the command is invoked from a subdirectory, show the\r
388         path of the current directory relative to the top-level\r
389         directory.\r
390 </p>\r
391 </dd>\r
392 <dt>\r
393 --show-cdup\r
394 </dt>\r
395 <dd>\r
396 <p>\r
397         When the command is invoked from a subdirectory, show the\r
398         path of the top-level directory relative to the current\r
399         directory (typically a sequence of "../", or an empty string).\r
400 </p>\r
401 </dd>\r
402 <dt>\r
403 --git-dir\r
404 </dt>\r
405 <dd>\r
406 <p>\r
407         Show <tt>$GIT_DIR</tt> if defined else show the path to the .git directory.\r
408 </p>\r
409 </dd>\r
410 <dt>\r
411 --short, --short=number\r
412 </dt>\r
413 <dd>\r
414 <p>\r
415         Instead of outputting the full SHA1 values of object names try to\r
416         abbriviate them to a shorter unique name. When no length is specified\r
417         7 is used. The minimum length is 4.\r
418 </p>\r
419 </dd>\r
420 <dt>\r
421 --since=datestring, --after=datestring\r
422 </dt>\r
423 <dd>\r
424 <p>\r
425         Parses the date string, and outputs corresponding\r
426         --max-age= parameter for git-rev-list command.\r
427 </p>\r
428 </dd>\r
429 <dt>\r
430 --until=datestring, --before=datestring\r
431 </dt>\r
432 <dd>\r
433 <p>\r
434         Parses the date string, and outputs corresponding\r
435         --min-age= parameter for git-rev-list command.\r
436 </p>\r
437 </dd>\r
438 <dt>\r
439 &lt;args&gt;&#8230;\r
440 </dt>\r
441 <dd>\r
442 <p>\r
443         Flags and parameters to be parsed.\r
444 </p>\r
445 </dd>\r
446 </dl>\r
447 </div>\r
448 <h2>SPECIFYING REVISIONS</h2>\r
449 <div class="sectionbody">\r
450 <p>A revision parameter typically, but not necessarily, names a\r
451 commit object.  They use what is called an <em>extended SHA1</em>\r
452 syntax.</p>\r
453 <ul>\r
454 <li>\r
455 <p>\r
456 The full SHA1 object name (40-byte hexadecimal string), or\r
457   a substring of such that is unique within the repository.\r
458   E.g. dae86e1950b1277e545cee180551750029cfe735 and dae86e both\r
459   name the same commit object if there are no other object in\r
460   your repository whose object name starts with dae86e.\r
461 </p>\r
462 </li>\r
463 <li>\r
464 <p>\r
465 A symbolic ref name.  E.g. <em>master</em> typically means the commit\r
466   object referenced by $GIT_DIR/refs/heads/master.  If you\r
467   happen to have both heads/master and tags/master, you can\r
468   explicitly say <em>heads/master</em> to tell git which one you mean.\r
469 </p>\r
470 </li>\r
471 <li>\r
472 <p>\r
473 A suffix <em>^</em> to a revision parameter means the first parent of\r
474   that commit object.  <em>^&lt;n&gt;</em> means the &lt;n&gt;th parent (i.e.\r
475   <em>rev^</em>\r
476   is equivalent to <em>rev^1</em>).  As a special rule,\r
477   <em>rev^0</em> means the commit itself and is used when <em>rev</em> is the\r
478   object name of a tag object that refers to a commit object.\r
479 </p>\r
480 </li>\r
481 <li>\r
482 <p>\r
483 A suffix <em>~&lt;n&gt;</em> to a revision parameter means the commit\r
484   object that is the &lt;n&gt;th generation grand-parent of the named\r
485   commit object, following only the first parent.  I.e. rev~3 is\r
486   equivalent to rev^^^ which is equivalent to  rev^1^1^1.\r
487 </p>\r
488 </li>\r
489 <li>\r
490 <p>\r
491 A suffix <em>^</em> followed by an object type name enclosed in\r
492   brace pair (e.g. <tt>v0.99.8^{commit}</tt>) means the object\r
493   could be a tag, and dereference the tag recursively until an\r
494   object of that type is found or the object cannot be\r
495   dereferenced anymore (in which case, barf).  <tt>rev^0</tt>\r
496   introduced earlier is a short-hand for <tt>rev^{commit}</tt>.\r
497 </p>\r
498 </li>\r
499 <li>\r
500 <p>\r
501 A suffix <em>^</em> followed by an empty brace pair\r
502   (e.g. <tt>v0.99.8^{}</tt>) means the object could be a tag,\r
503   and dereference the tag recursively until a non-tag object is\r
504   found.\r
505 </p>\r
506 </li>\r
507 </ul>\r
508 <p><em>git-rev-parse</em> also accepts a prefix <em>^</em> to revision parameter,\r
509 which is passed to <em>git-rev-list</em>.  Two revision parameters\r
510 concatenated with <em>..</em> is a short-hand for writing a range\r
511 between them.  I.e. <em>r1..r2</em> is equivalent to saying <em>^r1 r2</em></p>\r
512 <p>Here is an illustration, by Jon Loeliger.  Both node B and C are\r
513 a commit parents of commit node A.  Parent commits are ordered\r
514 left-to-right.</p>\r
515 <div class="literalblock">\r
516 <div class="content">\r
517 <pre><tt>G   H   I   J\r
518  \ /     \ /\r
519   D   E   F\r
520    \  |  /\r
521     \ | /\r
522      \|/\r
523       B     C\r
524        \   /\r
525         \ /\r
526          A</tt></pre>\r
527 </div></div>\r
528 <div class="literalblock">\r
529 <div class="content">\r
530 <pre><tt>A =      = A^0\r
531 B = A^   = A^1     = A~1\r
532 C = A^2  = A^2\r
533 D = A^^  = A^1^1   = A~2\r
534 E = B^2  = A^^2\r
535 F = B^3  = A^^3\r
536 G = A^^^ = A^1^1^1 = A~3\r
537 H = D^2  = B^^2    = A^^^2  = A~2^2\r
538 I = F^   = B^3^    = A^^3^\r
539 J = F^2  = B^3^2   = A^^3^2</tt></pre>\r
540 </div></div>\r
541 </div>\r
542 <h2>Author</h2>\r
543 <div class="sectionbody">\r
544 <p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt; and\r
545 Junio C Hamano &lt;junkio@cox.net&gt;</p>\r
546 </div>\r
547 <h2>Documentation</h2>\r
548 <div class="sectionbody">\r
549 <p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p>\r
550 </div>\r
551 <h2>GIT</h2>\r
552 <div class="sectionbody">\r
553 <p>Part of the <a href="git.html">git(7)</a> suite</p>\r
554 </div>\r
555 <div id="footer">\r
556 <div id="footer-text">\r
557 Last updated 20-Feb-2006 07:40:03 UTC\r
558 </div>\r
559 </div>\r
560 </body>\r
561 </html>\r