Skip to content

Commit ebd07c9

Browse files
committed
Merge branch 'sa/doc-ls-remote'
Doc update. * sa/doc-ls-remote: ls-remote doc: document the output format ls-remote doc: explain what each example does ls-remote doc: show peeled tags in examples ls-remote doc: remove redundant --tags example show-branch doc: say <ref>, not <reference> show-ref doc: update for internal consistency
2 parents 4c7d878 + 51f9d2e commit ebd07c9

File tree

3 files changed

+70
-34
lines changed

3 files changed

+70
-34
lines changed

Documentation/git-ls-remote.txt

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,27 +96,51 @@ OPTIONS
9696
separator (so `bar` matches `refs/heads/bar` but not
9797
`refs/heads/foobar`).
9898

99+
OUTPUT
100+
------
101+
102+
The output is in the format:
103+
104+
------------
105+
<oid> TAB <ref> LF
106+
------------
107+
108+
When showing an annotated tag, unless `--refs` is given, two such
109+
lines are shown: one with the refname for the tag itself as `<ref>`,
110+
and another with `<ref>` followed by `^{}`. The `<oid>` on the latter
111+
line shows the name of the object the tag points at.
112+
99113
EXAMPLES
100114
--------
101115

116+
* List all references (including symbolics and pseudorefs), peeling
117+
tags:
118+
+
119+
----
120+
$ git ls-remote
121+
27d43aaaf50ef0ae014b88bba294f93658016a2e HEAD
122+
950264636c68591989456e3ba0a5442f93152c1a refs/heads/main
123+
d9ab777d41f92a8c1684c91cfb02053d7dd1046b refs/heads/next
124+
d4ca2e3147b409459955613c152220f4db848ee1 refs/tags/v2.40.0
125+
73876f4861cd3d187a4682290ab75c9dccadbc56 refs/tags/v2.40.0^{}
102126
----
103-
$ git ls-remote --tags .
104-
d6602ec5194c87b0fc87103ca4d67251c76f233a refs/tags/v0.99
105-
f25a265a342aed6041ab0cc484224d9ca54b6f41 refs/tags/v0.99.1
106-
7ceca275d047c90c0c7d5afb13ab97efdf51bd6e refs/tags/v0.99.3
107-
c5db5456ae3b0873fc659c19fafdde22313cc441 refs/tags/v0.99.2
108-
0918385dbd9656cab0d1d81ba7453d49bbc16250 refs/tags/junio-gpg-pub
109127

128+
* List all references matching given patterns:
129+
+
130+
----
110131
$ git ls-remote http://www.kernel.org/pub/scm/git/git.git master seen rc
111132
5fe978a5381f1fbad26a80e682ddd2a401966740 refs/heads/master
112133
c781a84b5204fb294c9ccc79f8b3baceeb32c061 refs/heads/seen
134+
----
113135

114-
$ git remote add korg http://www.kernel.org/pub/scm/git/git.git
115-
$ git ls-remote --tags korg v\*
116-
d6602ec5194c87b0fc87103ca4d67251c76f233a refs/tags/v0.99
117-
f25a265a342aed6041ab0cc484224d9ca54b6f41 refs/tags/v0.99.1
118-
c5db5456ae3b0873fc659c19fafdde22313cc441 refs/tags/v0.99.2
119-
7ceca275d047c90c0c7d5afb13ab97efdf51bd6e refs/tags/v0.99.3
136+
* List only tags matching a given wildcard pattern:
137+
+
138+
----
139+
$ git ls-remote --tags http://www.kernel.org/pub/scm/git/git.git v\*
140+
485a869c64a68cc5795dd99689797c5900f4716d refs/tags/v2.39.2
141+
cbf04937d5b9fcf0a76c28f69e6294e9e3ecd7e6 refs/tags/v2.39.2^{}
142+
d4ca2e3147b409459955613c152220f4db848ee1 refs/tags/v2.40.0
143+
73876f4861cd3d187a4682290ab75c9dccadbc56 refs/tags/v2.40.0^{}
120144
----
121145

122146
SEE ALSO

Documentation/git-show-branch.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ OPTIONS
7474
that is the common ancestor of all the branches. This
7575
flag tells the command to go <n> more common commits
7676
beyond that. When <n> is negative, display only the
77-
<reference>s given, without showing the commit ancestry
78-
tree.
77+
<ref>s given, without showing the commit ancestry tree.
7978

8079
--list::
8180
Synonym to `--more=-1`
@@ -88,8 +87,8 @@ OPTIONS
8887
the case of three or more commits.
8988

9089
--independent::
91-
Among the <reference>s given, display only the ones that
92-
cannot be reached from any other <reference>.
90+
Among the <ref>s given, display only the ones that cannot be
91+
reached from any other <ref>.
9392

9493
--no-name::
9594
Do not show naming strings for each commit.
@@ -132,10 +131,11 @@ are mutually exclusive.
132131

133132
OUTPUT
134133
------
135-
Given N <references>, the first N lines are the one-line
136-
description from their commit message. The branch head that is
137-
pointed at by $GIT_DIR/HEAD is prefixed with an asterisk `*`
138-
character while other heads are prefixed with a `!` character.
134+
135+
Given N <ref>s, the first N lines are the one-line description from
136+
their commit message. The branch head that is pointed at by
137+
$GIT_DIR/HEAD is prefixed with an asterisk `*` character while other
138+
heads are prefixed with a `!` character.
139139

140140
Following these N lines, one-line log for each commit is
141141
displayed, indented N places. If a commit is on the I-th

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)