]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-ls-remote.txt
Start the 2.46 cycle
[thirdparty/git.git] / Documentation / git-ls-remote.txt
CommitLineData
215a7ad1
JH
1git-ls-remote(1)
2================
972b6fe7
JH
3
4NAME
5----
0dde6899 6git-ls-remote - List references in a remote repository
972b6fe7
JH
7
8
9SYNOPSIS
10--------
0dde6899 11[verse]
40a88529 12'git ls-remote' [--heads] [--tags] [--refs] [--upload-pack=<exec>]
1fb20dfd 13 [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]
d9ec3b0d 14 [--symref] [<repository> [<patterns>...]]
972b6fe7
JH
15
16DESCRIPTION
17-----------
0dde6899
JF
18Displays references available in a remote repository along with the associated
19commit IDs.
972b6fe7
JH
20
21
22OPTIONS
23-------
3240240f
SB
24-h::
25--heads::
26-t::
27--tags::
972b6fe7
JH
28 Limit to only refs/heads and refs/tags, respectively.
29 These options are _not_ mutually exclusive; when given
30 both, references stored in refs/heads and refs/tags are
1ff466c0
JH
31 displayed. Note that `git ls-remote -h` used without
32 anything else on the command line gives help, consistent
33 with other git subcommands.
972b6fe7 34
40a88529 35--refs::
8d75a1d1 36 Do not show peeled tags or pseudorefs like `HEAD` in the output.
40a88529 37
54813bdd
TG
38-q::
39--quiet::
40 Do not print remote URL to stderr.
41
3240240f 42--upload-pack=<exec>::
ba020ef5 43 Specify the full path of 'git-upload-pack' on the remote
0dde6899 44 host. This allows listing references from repositories accessed via
23bfbb81 45 SSH and where the SSH daemon does not use the PATH configured by the
f0294272 46 user.
0dde6899 47
a8724773
MS
48--exit-code::
49 Exit with status "2" when no matching refs are found in the remote
50 repository. Usually the command exits with status "0" to indicate
51 it successfully talked with the remote repository, whether it
52 found any matching refs.
53
2303cad2
SN
54--get-url::
55 Expand the URL of the given remote repository taking into account any
56 "url.<base>.insteadOf" config setting (See linkgit:git-config[1]) and
57 exit without talking to the remote.
58
99c08d4e
TG
59--symref::
60 In addition to the object pointed by it, show the underlying
61 ref pointed by it when showing a symbolic ref. Currently,
62 upload-pack only shows the symref HEAD, so it will be the only
63 one shown by ls-remote.
64
1fb20dfd
HN
65--sort=<key>::
66 Sort based on the key given. Prefix `-` to sort in descending order
67 of the value. Supports "version:refname" or "v:refname" (tag names
68 are treated as versions). The "version:refname" sort order can also
69 be affected by the "versionsort.suffix" configuration variable.
70 See linkgit:git-for-each-ref[1] for more sort options, but be aware
71 keys like `committerdate` that require access to the objects
72 themselves will not work for refs whose objects have not yet been
73 fetched from the remote, and will give a `missing object` error.
74
ff473221
BW
75-o <option>::
76--server-option=<option>::
77 Transmit the given string to the server when communicating using
78 protocol version 2. The given string must not contain a NUL or LF
79 character.
80 When multiple `--server-option=<option>` are given, they are all
81 sent to the other side in the order listed on the command line.
82
972b6fe7 83<repository>::
88e36141
RR
84 The "remote" repository to query. This parameter can be
85 either a URL or the name of a remote (see the GIT URLS and
86 REMOTES sections of linkgit:git-fetch[1]).
972b6fe7 87
d9ec3b0d 88<patterns>...::
972b6fe7 89 When unspecified, all references, after filtering done
d9ec3b0d
JK
90 with --heads and --tags, are shown. When <patterns>... are
91 specified, only references matching one or more of the given
92 patterns are displayed. Each pattern is interpreted as a glob
93 (see `glob` in linkgit:gitglossary[7]) which is matched against
94 the "tail" of a ref, starting either from the start of the ref
95 (so a full name like `refs/heads/foo` matches) or from a slash
96 separator (so `bar` matches `refs/heads/bar` but not
97 `refs/heads/foobar`).
972b6fe7 98
51f9d2e5
SA
99OUTPUT
100------
101
102The output is in the format:
103
104------------
105<oid> TAB <ref> LF
106------------
107
108When showing an annotated tag, unless `--refs` is given, two such
109lines are shown: one with the refname for the tag itself as `<ref>`,
110and another with `<ref>` followed by `^{}`. The `<oid>` on the latter
111line shows the name of the object the tag points at.
112
972b6fe7
JH
113EXAMPLES
114--------
115
51f9d2e5
SA
116* List all references (including symbolics and pseudorefs), peeling
117 tags:
118+
119----
120$ git ls-remote
12127d43aaaf50ef0ae014b88bba294f93658016a2e HEAD
122950264636c68591989456e3ba0a5442f93152c1a refs/heads/main
123d9ab777d41f92a8c1684c91cfb02053d7dd1046b refs/heads/next
124d4ca2e3147b409459955613c152220f4db848ee1 refs/tags/v2.40.0
12573876f4861cd3d187a4682290ab75c9dccadbc56 refs/tags/v2.40.0^{}
126----
127
a5b07632
SA
128* List all references matching given patterns:
129+
53718137 130----
828197de 131$ git ls-remote http://www.kernel.org/pub/scm/git/git.git master seen rc
53718137 1325fe978a5381f1fbad26a80e682ddd2a401966740 refs/heads/master
828197de 133c781a84b5204fb294c9ccc79f8b3baceeb32c061 refs/heads/seen
a5b07632 134----
baebde7d 135
a5b07632
SA
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\*
e959fa45
SA
140485a869c64a68cc5795dd99689797c5900f4716d refs/tags/v2.39.2
141cbf04937d5b9fcf0a76c28f69e6294e9e3ecd7e6 refs/tags/v2.39.2^{}
142d4ca2e3147b409459955613c152220f4db848ee1 refs/tags/v2.40.0
14373876f4861cd3d187a4682290ab75c9dccadbc56 refs/tags/v2.40.0^{}
53718137 144----
972b6fe7 145
1fb20dfd
HN
146SEE ALSO
147--------
148linkgit:git-check-ref-format[1].
149
972b6fe7
JH
150GIT
151---
9e1f0a85 152Part of the linkgit:git[1] suite