Updated git_doc to git 1.8
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-show-ref.xml
blob46dc8331bbe3ee8089ef4042667666c58e5aff59
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <sect2 lang="en" id="git-show-ref(1)">\r
5     <title>git-show-ref(1)</title>\r
6 <indexterm>\r
7 <primary>git-show-ref(1)</primary>\r
8 </indexterm>\r
9 <simplesect id="git-show-ref(1)__name">\r
10 <title>NAME</title>\r
11 <simpara>git-show-ref - List references in a local repository</simpara>\r
12 </simplesect>\r
13 <simplesect id="git-show-ref(1)__synopsis">\r
14 <title>SYNOPSIS</title>\r
15 <blockquote>\r
16 <literallayout><emphasis>git show-ref</emphasis> [-q|--quiet] [--verify] [--head] [-d|--dereference]\r
17              [-s|--hash[=&lt;n&gt;]] [--abbrev[=&lt;n&gt;]] [--tags]\r
18              [--heads] [--] [&lt;pattern&gt;&#8230;]\r
19 <emphasis>git show-ref</emphasis> --exclude-existing[=&lt;pattern&gt;] &lt; ref-list</literallayout>\r
20 </blockquote>\r
21 </simplesect>\r
22 <simplesect id="git-show-ref(1)__description">\r
23 <title>DESCRIPTION</title>\r
24 <simpara>Displays references available in a local repository along with the associated\r
25 commit IDs. Results can be filtered using a pattern and tags can be\r
26 dereferenced into object IDs. Additionally, it can be used to test whether a\r
27 particular ref exists.</simpara>\r
28 <simpara>The --exclude-existing form is a filter that does the inverse, it shows the\r
29 refs from stdin that don't exist in the local repository.</simpara>\r
30 <simpara>Use of this utility is encouraged in favor of directly accessing files under\r
31 the <emphasis>.git</emphasis> directory.</simpara>\r
32 </simplesect>\r
33 <simplesect id="git-show-ref(1)__options">\r
34 <title>OPTIONS</title>\r
35 <variablelist>\r
36 <varlistentry>\r
37 <term>\r
38 --head\r
39 </term>\r
40 <listitem>\r
41 <simpara>\r
42         Show the HEAD reference.\r
43 </simpara>\r
44 </listitem>\r
45 </varlistentry>\r
46 <varlistentry>\r
47 <term>\r
48 --tags\r
49 </term>\r
50 <term>\r
51 --heads\r
52 </term>\r
53 <listitem>\r
54 <simpara>\r
55         Limit to only "refs/heads" and "refs/tags", respectively.  These\r
56         options are not mutually exclusive; when given both, references stored\r
57         in "refs/heads" and "refs/tags" are displayed.\r
58 </simpara>\r
59 </listitem>\r
60 </varlistentry>\r
61 <varlistentry>\r
62 <term>\r
63 -d\r
64 </term>\r
65 <term>\r
66 --dereference\r
67 </term>\r
68 <listitem>\r
69 <simpara>\r
70         Dereference tags into object IDs as well. They will be shown with "&#94;{}"\r
71         appended.\r
72 </simpara>\r
73 </listitem>\r
74 </varlistentry>\r
75 <varlistentry>\r
76 <term>\r
77 -s\r
78 </term>\r
79 <term>\r
80 --hash[=&lt;n&gt;]\r
81 </term>\r
82 <listitem>\r
83 <simpara>\r
84         Only show the SHA1 hash, not the reference name. When combined with\r
85         --dereference the dereferenced tag will still be shown after the SHA1.\r
86 </simpara>\r
87 </listitem>\r
88 </varlistentry>\r
89 <varlistentry>\r
90 <term>\r
91 --verify\r
92 </term>\r
93 <listitem>\r
94 <simpara>\r
95         Enable stricter reference checking by requiring an exact ref path.\r
96         Aside from returning an error code of 1, it will also print an error\r
97         message if <emphasis>--quiet</emphasis> was not specified.\r
98 </simpara>\r
99 </listitem>\r
100 </varlistentry>\r
101 <varlistentry>\r
102 <term>\r
103 --abbrev[=&lt;n&gt;]\r
104 </term>\r
105 <listitem>\r
106 <simpara>\r
107         Abbreviate the object name.  When using <emphasis>--hash</emphasis>, you do\r
108         not have to say <emphasis>--hash --abbrev</emphasis>; <emphasis>--hash=n</emphasis> would do.\r
109 </simpara>\r
110 </listitem>\r
111 </varlistentry>\r
112 <varlistentry>\r
113 <term>\r
114 -q\r
115 </term>\r
116 <term>\r
117 --quiet\r
118 </term>\r
119 <listitem>\r
120 <simpara>\r
121         Do not print any results to stdout. When combined with <emphasis>--verify</emphasis> this\r
122         can be used to silently check if a reference exists.\r
123 </simpara>\r
124 </listitem>\r
125 </varlistentry>\r
126 <varlistentry>\r
127 <term>\r
128 --exclude-existing[=&lt;pattern&gt;]\r
129 </term>\r
130 <listitem>\r
131 <simpara>\r
132         Make <emphasis>git show-ref</emphasis> act as a filter that reads refs from stdin of the\r
133         form "<emphasis>^(?:&lt;anything&gt;\s)?&lt;refname&gt;(?:\^{})?$</emphasis>"\r
134         and performs the following actions on each:\r
135         (1) strip "&#94;{}" at the end of line if any;\r
136         (2) ignore if pattern is provided and does not head-match refname;\r
137         (3) warn if refname is not a well-formed refname and skip;\r
138         (4) ignore if refname is a ref that exists in the local repository;\r
139         (5) otherwise output the line.\r
140 </simpara>\r
141 </listitem>\r
142 </varlistentry>\r
143 <varlistentry>\r
144 <term>\r
145 &lt;pattern&gt;&#8230;\r
146 </term>\r
147 <listitem>\r
148 <simpara>\r
149         Show references matching one or more patterns. Patterns are matched from\r
150         the end of the full name, and only complete parts are matched, e.g.\r
151         <emphasis>master</emphasis> matches <emphasis>refs/heads/master</emphasis>, <emphasis>refs/remotes/origin/master</emphasis>,\r
152         <emphasis>refs/tags/jedi/master</emphasis> but not <emphasis>refs/heads/mymaster</emphasis> nor\r
153         <emphasis>refs/remotes/master/jedi</emphasis>.\r
154 </simpara>\r
155 </listitem>\r
156 </varlistentry>\r
157 </variablelist>\r
158 </simplesect>\r
159 <simplesect id="git-show-ref(1)__output">\r
160 <title>OUTPUT</title>\r
161 <simpara>The output is in the format: <emphasis>&lt;SHA-1 ID&gt;</emphasis> <emphasis>&lt;space&gt;</emphasis> <emphasis>&lt;reference name&gt;</emphasis>.</simpara>\r
162 <screen>$ git show-ref --head --dereference\r
163 832e76a9899f560a90ffd62ae2ce83bbeff58f54 HEAD\r
164 832e76a9899f560a90ffd62ae2ce83bbeff58f54 refs/heads/master\r
165 832e76a9899f560a90ffd62ae2ce83bbeff58f54 refs/heads/origin\r
166 3521017556c5de4159da4615a39fa4d5d2c279b5 refs/tags/v0.99.9c\r
167 6ddc0964034342519a87fe013781abf31c6db6ad refs/tags/v0.99.9c^{}\r
168 055e4ae3ae6eb344cbabf2a5256a49ea66040131 refs/tags/v1.0rc4\r
169 423325a2d24638ddcc82ce47be5e40be550f4507 refs/tags/v1.0rc4^{}\r
170 ...</screen>\r
171 <simpara>When using --hash (and not --dereference) the output format is: <emphasis>&lt;SHA-1 ID&gt;</emphasis></simpara>\r
172 <screen>$ git show-ref --heads --hash\r
173 2e3ba0114a1f52b47df29743d6915d056be13278\r
174 185008ae97960c8d551adcd9e23565194651b5d1\r
175 03adf42c988195b50e1a1935ba5fcbc39b2b029b\r
176 ...</screen>\r
177 </simplesect>\r
178 <simplesect id="git-show-ref(1)__example">\r
179 <title>EXAMPLE</title>\r
180 <simpara>To show all references called "master", whether tags or heads or anything\r
181 else, and regardless of how deep in the reference naming hierarchy they are,\r
182 use:</simpara>\r
183 <screen>        git show-ref master</screen>\r
184 <simpara>This will show "refs/heads/master" but also "refs/remote/other-repo/master",\r
185 if such references exists.</simpara>\r
186 <simpara>When using the <emphasis>--verify</emphasis> flag, the command requires an exact path:</simpara>\r
187 <screen>        git show-ref --verify refs/heads/master</screen>\r
188 <simpara>will only match the exact branch called "master".</simpara>\r
189 <simpara>If nothing matches, <emphasis>git show-ref</emphasis> will return an error code of 1,\r
190 and in the case of verification, it will show an error message.</simpara>\r
191 <simpara>For scripting, you can ask it to be quiet with the "--quiet" flag, which\r
192 allows you to do things like</simpara>\r
193 <screen>        git show-ref --quiet --verify -- "refs/heads/$headname" ||\r
194                 echo "$headname is not a valid branch"</screen>\r
195 <simpara>to check whether a particular branch exists or not (notice how we don't\r
196 actually want to show any results, and we want to use the full refname for it\r
197 in order to not trigger the problem with ambiguous partial matches).</simpara>\r
198 <simpara>To show only tags, or only proper branch heads, use "--tags" and/or "--heads"\r
199 respectively (using both means that it shows tags and heads, but not other\r
200 random references under the refs/ subdirectory).</simpara>\r
201 <simpara>To do automatic tag object dereferencing, use the "-d" or "--dereference"\r
202 flag, so you can do</simpara>\r
203 <screen>        git show-ref --tags --dereference</screen>\r
204 <simpara>to get a listing of all tags together with what they dereference.</simpara>\r
205 </simplesect>\r
206 <simplesect id="git-show-ref(1)__files">\r
207 <title>FILES</title>\r
208 <simpara><emphasis>.git/refs/*</emphasis>, <emphasis>.git/packed-refs</emphasis></simpara>\r
209 </simplesect>\r
210 <simplesect id="git-show-ref(1)__see_also">\r
211 <title>SEE ALSO</title>\r
212 <simpara><xref linkend="git-ls-remote(1)" />,\r
213 <xref linkend="git-update-ref(1)" />,\r
214 <xref linkend="gitrepository-layout(5)" /></simpara>\r
215 </simplesect>\r
216 <simplesect id="git-show-ref(1)__git">\r
217 <title>GIT</title>\r
218 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
219 </simplesect>\r
220 </sect2>\r