Autogenerated man pages for v1.2.2-g709a
[git.git] / man1 / git-rev-parse.1
1 .\"Generated by db2man.xsl. Don't modify this, modify the source.
2 .de Sh \" Subsection
3 .br
4 .if t .Sp
5 .ne 5
6 .PP
7 \fB\\$1\fR
8 .PP
9 ..
10 .de Sp \" Vertical space (when we can't use .PP)
11 .if t .sp .5v
12 .if n .sp
13 ..
14 .de Ip \" List item
15 .br
16 .ie \\n(.$>=3 .ne \\$3
17 .el .ne 3
18 .IP "\\$1" \\$2
19 ..
20 .TH "GIT-REV-PARSE" 1 "" "" ""
21 .SH NAME
22 git-rev-parse \- Pick out and massage parameters.
23 .SH "SYNOPSIS"
24
25
26 \fIgit\-rev\-parse\fR [ \-\-option ] <args>...
27
28 .SH "DESCRIPTION"
29
30
31 Many git Porcelainish commands take mixture of flags (i\&.e\&. parameters that begin with a dash \fI\-\fR) and parameters meant for underlying git\-rev\-list command they use internally and flags and parameters for other commands they use as the downstream of git\-rev\-list\&. This command is used to distinguish between them\&.
32
33 .SH "OPTIONS"
34
35 .TP
36 \-\-revs\-only
37 Do not output flags and parameters not meant for git\-rev\-list command\&.
38
39 .TP
40 \-\-no\-revs
41 Do not output flags and parameters meant for git\-rev\-list command\&.
42
43 .TP
44 \-\-flags
45 Do not output non\-flag parameters\&.
46
47 .TP
48 \-\-no\-flags
49 Do not output flag parameters\&.
50
51 .TP
52 \-\-default <arg>
53 If there is no parameter given by the user, use <arg> instead\&.
54
55 .TP
56 \-\-verify
57 The parameter given must be usable as a single, valid object name\&. Otherwise barf and abort\&.
58
59 .TP
60 \-\-sq
61 Usually the output is made one line per flag and parameter\&. This option makes output a single line, properly quoted for consumption by shell\&. Useful when you expect your parameter to contain whitespaces and newlines (e\&.g\&. when using pickaxe \-S with git\-diff\-*)\&.
62
63 .TP
64 \-\-not
65 When showing object names, prefix them with \fI^\fR and strip \fI^\fR prefix from the object names that already have one\&.
66
67 .TP
68 \-\-symbolic
69 Usually the object names are output in SHA1 form (with possible \fI^\fR prefix); this option makes them output in a form as close to the original input as possible\&.
70
71 .TP
72 \-\-all
73 Show all refs found in $GIT_DIR/refs\&.
74
75 .TP
76 \-\-show\-prefix
77 When the command is invoked from a subdirectory, show the path of the current directory relative to the top\-level directory\&.
78
79 .TP
80 \-\-show\-cdup
81 When the command is invoked from a subdirectory, show the path of the top\-level directory relative to the current directory (typically a sequence of "\&.\&./", or an empty string)\&.
82
83 .TP
84 \-\-git\-dir
85 Show $GIT_DIR if defined else show the path to the \&.git directory\&.
86
87 .TP
88 \-\-short, short=number
89 Instead of outputting the full SHA1 values of object names try to abbriviate them to a shorter unique name\&. When no length is specified 7 is used\&. The minimum length is 4\&.
90
91 .TP
92 \-\-since=datestring, \-\-after=datestring
93 Parses the date string, and outputs corresponding \-\-max\-age= parameter for git\-rev\-list command\&.
94
95 .TP
96 \-\-until=datestring, \-\-before=datestring
97 Parses the date string, and outputs corresponding \-\-min\-age= parameter for git\-rev\-list command\&.
98
99 .TP
100 <args>...
101 Flags and parameters to be parsed\&.
102
103 .SH "SPECIFYING REVISIONS"
104
105
106 A revision parameter typically, but not necessarily, names a commit object\&. They use what is called an \fIextended SHA1\fR syntax\&.
107
108 .TP 3
109 \(bu
110 The full SHA1 object name (40\-byte hexadecimal string), or a substring of such that is unique within the repository\&. E\&.g\&. dae86e1950b1277e545cee180551750029cfe735 and dae86e both name the same commit object if there are no other object in your repository whose object name starts with dae86e\&.
111 .TP
112 \(bu
113 A symbolic ref name\&. E\&.g\&. \fImaster\fR typically means the commit object referenced by $GIT_DIR/refs/heads/master\&. If you happen to have both heads/master and tags/master, you can explicitly say \fIheads/master\fR to tell git which one you mean\&.
114 .TP
115 \(bu
116 A suffix \fI^\fR to a revision parameter means the first parent of that commit object\&. \fI^<n>\fR means the <n>th parent (i\&.e\&. \fIrev^\fR is equivalent to \fIrev^1\fR)\&. As a special rule, \fIrev^0\fR means the commit itself and is used when \fIrev\fR is the object name of a tag object that refers to a commit object\&.
117 .TP
118 \(bu
119 A suffix \fI~<n>\fR to a revision parameter means the commit object that is the <n>th generation grand\-parent of the named commit object, following only the first parent\&. I\&.e\&. rev~3 is equivalent to rev^^^ which is equivalent to rev^1^1^1\&.
120 .TP
121 \(bu
122 A suffix \fI^\fR followed by an object type name enclosed in brace pair (e\&.g\&. v0\&.99\&.8^{commit}) means the object could be a tag, and dereference the tag recursively until an object of that type is found or the object cannot be dereferenced anymore (in which case, barf)\&. rev^0 introduced earlier is a short\-hand for rev^{commit}\&.
123 .TP
124 \(bu
125 A suffix \fI^\fR followed by an empty brace pair (e\&.g\&. v0\&.99\&.8^{}) means the object could be a tag, and dereference the tag recursively until a non\-tag object is found\&.
126 .LP
127
128
129 \fIgit\-rev\-parse\fR also accepts a prefix \fI^\fR to revision parameter, which is passed to \fIgit\-rev\-list\fR\&. Two revision parameters concatenated with \fI\&.\&.\fR is a short\-hand for writing a range between them\&. I\&.e\&. \fIr1\&.\&.r2\fR is equivalent to saying \fI^r1 r2\fR
130
131
132 Here is an illustration, by Jon Loeliger\&. Both node B and C are a commit parents of commit node A\&. Parent commits are ordered left\-to\-right\&.
133
134 .nf
135 G   H   I   J
136  \\ /     \\ /
137   D   E   F
138    \\  |  /
139     \\ | /
140      \\|/
141       B     C
142        \\   /
143         \\ /
144          A
145 .fi
146
147 .nf
148 A =      = A^0
149 B = A^   = A^1     = A~1
150 C = A^2  = A^2
151 D = A^^  = A^1^1   = A~2
152 E = B^2  = A^^2
153 F = B^3  = A^^3
154 G = A^^^ = A^1^1^1 = A~3
155 H = D^2  = B^^2    = A^^^2  = A~2^2
156 I = F^   = B^3^    = A^^3^
157 J = F^2  = B^3^2   = A^^3^2
158 .fi
159
160 .SH "AUTHOR"
161
162
163 Written by Linus Torvalds <torvalds@osdl\&.org> and Junio C Hamano <junkio@cox\&.net>
164
165 .SH "DOCUMENTATION"
166
167
168 Documentation by Junio C Hamano and the git\-list <git@vger\&.kernel\&.org>\&.
169
170 .SH "GIT"
171
172
173 Part of the \fBgit\fR(7) suite
174