Autogenerated man pages for v1.4.0-rc1-gdd82
[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 \-\-branches
77 Show branch refs found in $GIT_DIR/refs/heads\&.
78
79 .TP
80 \-\-tags
81 Show tag refs found in $GIT_DIR/refs/tags\&.
82
83 .TP
84 \-\-remotes
85 Show tag refs found in $GIT_DIR/refs/remotes\&.
86
87 .TP
88 \-\-show\-prefix
89 When the command is invoked from a subdirectory, show the path of the current directory relative to the top\-level directory\&.
90
91 .TP
92 \-\-show\-cdup
93 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)\&.
94
95 .TP
96 \-\-git\-dir
97 Show $GIT_DIR if defined else show the path to the \&.git directory\&.
98
99 .TP
100 \-\-short, \-\-short=number
101 Instead of outputting the full SHA1 values of object names try to abbreviate them to a shorter unique name\&. When no length is specified 7 is used\&. The minimum length is 4\&.
102
103 .TP
104 \-\-since=datestring, \-\-after=datestring
105 Parses the date string, and outputs corresponding \-\-max\-age= parameter for git\-rev\-list command\&.
106
107 .TP
108 \-\-until=datestring, \-\-before=datestring
109 Parses the date string, and outputs corresponding \-\-min\-age= parameter for git\-rev\-list command\&.
110
111 .TP
112 <args>...
113 Flags and parameters to be parsed\&.
114
115 .SH "SPECIFYING REVISIONS"
116
117
118 A revision parameter typically, but not necessarily, names a commit object\&. They use what is called an \fIextended SHA1\fR syntax\&.
119
120 .TP 3
121 \(bu
122 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\&.
123 .TP
124 \(bu
125 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\&.
126 .TP
127 \(bu
128 A suffix \fI@\fR followed by a date specification enclosed in a brace pair (e\&.g\&. \fI{yesterday}\fR, \fI{1 month 2 weeks 3 days 1 hour 1 second ago}\fR or \fI{1979\-02\-26 18:30:00}\fR) to specify the value of the ref at a prior point in time\&. This suffix may only be used immediately following a ref name and the ref must have an existing log ($GIT_DIR/logs/<ref>)\&.
129 .TP
130 \(bu
131 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\&.
132 .TP
133 \(bu
134 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\&.
135 .TP
136 \(bu
137 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}\&.
138 .TP
139 \(bu
140 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\&.
141 .LP
142
143
144 \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
145
146
147 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\&.
148
149 .nf
150 G   H   I   J
151  \\ /     \\ /
152   D   E   F
153    \\  |  /
154     \\ | /
155      \\|/
156       B     C
157        \\   /
158         \\ /
159          A
160 .fi
161
162 .nf
163 A =      = A^0
164 B = A^   = A^1     = A~1
165 C = A^2  = A^2
166 D = A^^  = A^1^1   = A~2
167 E = B^2  = A^^2
168 F = B^3  = A^^3
169 G = A^^^ = A^1^1^1 = A~3
170 H = D^2  = B^^2    = A^^^2  = A~2^2
171 I = F^   = B^3^    = A^^3^
172 J = F^2  = B^3^2   = A^^3^2
173 .fi
174
175 .SH "AUTHOR"
176
177
178 Written by Linus Torvalds <torvalds@osdl\&.org> and Junio C Hamano <junkio@cox\&.net>
179
180 .SH "DOCUMENTATION"
181
182
183 Documentation by Junio C Hamano and the git\-list <git@vger\&.kernel\&.org>\&.
184
185 .SH "GIT"
186
187
188 Part of the \fBgit\fR(7) suite
189