Skip to content

Commit 00bf685

Browse files
vermiculusgitster
authored andcommitted
show-ref doc: update for internal consistency
- Use inline-code syntax for options where appropriate. - Use code blocks to clarify output format. - Use 'OID' (for 'object ID') instead of 'SHA-1' as we support different hashing algorithms these days. Signed-off-by: Sean Allred <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5bc069e commit 00bf685

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

Documentation/git-show-ref.txt

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ particular ref exists.
2323

2424
By default, shows the tags, heads, and remote refs.
2525

26-
The --exclude-existing form is a filter that does the inverse. It reads
26+
The `--exclude-existing` form is a filter that does the inverse. It reads
2727
refs from stdin, one ref per line, and shows those that don't exist in
2828
the local repository.
2929

@@ -47,14 +47,14 @@ OPTIONS
4747
-d::
4848
--dereference::
4949

50-
Dereference tags into object IDs as well. They will be shown with "{caret}{}"
50+
Dereference tags into object IDs as well. They will be shown with `{caret}{}`
5151
appended.
5252

5353
-s::
5454
--hash[=<n>]::
5555

56-
Only show the SHA-1 hash, not the reference name. When combined with
57-
--dereference the dereferenced tag will still be shown after the SHA-1.
56+
Only show the OID, not the reference name. When combined with
57+
`--dereference`, the dereferenced tag will still be shown after the OID.
5858

5959
--verify::
6060

@@ -70,15 +70,15 @@ OPTIONS
7070
-q::
7171
--quiet::
7272

73-
Do not print any results to stdout. When combined with `--verify` this
73+
Do not print any results to stdout. When combined with `--verify`, this
7474
can be used to silently check if a reference exists.
7575

7676
--exclude-existing[=<pattern>]::
7777

78-
Make 'git show-ref' act as a filter that reads refs from stdin of the
79-
form "`^(?:<anything>\s)?<refname>(?:\^{})?$`"
78+
Make `git show-ref` act as a filter that reads refs from stdin of the
79+
form `^(?:<anything>\s)?<refname>(?:\^{})?$`
8080
and performs the following actions on each:
81-
(1) strip "{caret}{}" at the end of line if any;
81+
(1) strip `{caret}{}` at the end of line if any;
8282
(2) ignore if pattern is provided and does not head-match refname;
8383
(3) warn if refname is not a well-formed refname and skip;
8484
(4) ignore if refname is a ref that exists in the local repository;
@@ -96,7 +96,13 @@ OPTIONS
9696
OUTPUT
9797
------
9898

99-
The output is in the format: '<SHA-1 ID>' '<space>' '<reference name>'.
99+
The output is in the format:
100+
101+
------------
102+
<oid> SP <ref> LF
103+
------------
104+
105+
For example,
100106

101107
-----------------------------------------------------------------------------
102108
$ git show-ref --head --dereference
@@ -110,7 +116,13 @@ $ git show-ref --head --dereference
110116
...
111117
-----------------------------------------------------------------------------
112118

113-
When using --hash (and not --dereference) the output format is: '<SHA-1 ID>'
119+
When using `--hash` (and not `--dereference`), the output is in the format:
120+
121+
------------
122+
<oid> LF
123+
------------
124+
125+
For example,
114126

115127
-----------------------------------------------------------------------------
116128
$ git show-ref --heads --hash
@@ -142,10 +154,10 @@ When using the `--verify` flag, the command requires an exact path:
142154

143155
will only match the exact branch called "master".
144156

145-
If nothing matches, 'git show-ref' will return an error code of 1,
157+
If nothing matches, `git show-ref` will return an error code of 1,
146158
and in the case of verification, it will show an error message.
147159

148-
For scripting, you can ask it to be quiet with the "--quiet" flag, which
160+
For scripting, you can ask it to be quiet with the `--quiet` flag, which
149161
allows you to do things like
150162

151163
-----------------------------------------------------------------------------
@@ -157,11 +169,11 @@ to check whether a particular branch exists or not (notice how we don't
157169
actually want to show any results, and we want to use the full refname for it
158170
in order to not trigger the problem with ambiguous partial matches).
159171

160-
To show only tags, or only proper branch heads, use "--tags" and/or "--heads"
172+
To show only tags, or only proper branch heads, use `--tags` and/or `--heads`
161173
respectively (using both means that it shows tags and heads, but not other
162174
random references under the refs/ subdirectory).
163175

164-
To do automatic tag object dereferencing, use the "-d" or "--dereference"
176+
To do automatic tag object dereferencing, use the `-d` or `--dereference`
165177
flag, so you can do
166178

167179
-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)