Git 2.46
[alt-git.git] / Documentation / git-ls-remote.txt
blob76c86c3ce4fee0cabc8015a1a372e3931bd97155
1 git-ls-remote(1)
2 ================
4 NAME
5 ----
6 git-ls-remote - List references in a remote repository
9 SYNOPSIS
10 --------
11 [verse]
12 'git ls-remote' [--branches] [--tags] [--refs] [--upload-pack=<exec>]
13               [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]
14               [--symref] [<repository> [<patterns>...]]
16 DESCRIPTION
17 -----------
18 Displays references available in a remote repository along with the associated
19 commit IDs.
22 OPTIONS
23 -------
24 -b::
25 --branches::
26 -t::
27 --tags::
28         Limit to only local branches and local tags, respectively.
29         These options are _not_ mutually exclusive; when given
30         both, references stored in refs/heads and refs/tags are
31         displayed.  Note that `--heads` and `-h` are deprecated
32         synonyms for `--branches` and `-b` and may be removed in
33         the future.  Also note that `git ls-remote -h` used without
34         anything else on the command line gives help, consistent
35         with other git subcommands.
37 --refs::
38         Do not show peeled tags or pseudorefs like `HEAD` in the output.
40 -q::
41 --quiet::
42         Do not print remote URL to stderr.
44 --upload-pack=<exec>::
45         Specify the full path of 'git-upload-pack' on the remote
46         host. This allows listing references from repositories accessed via
47         SSH and where the SSH daemon does not use the PATH configured by the
48         user.
50 --exit-code::
51         Exit with status "2" when no matching refs are found in the remote
52         repository. Usually the command exits with status "0" to indicate
53         it successfully talked with the remote repository, whether it
54         found any matching refs.
56 --get-url::
57         Expand the URL of the given remote repository taking into account any
58         "url.<base>.insteadOf" config setting (See linkgit:git-config[1]) and
59         exit without talking to the remote.
61 --symref::
62         In addition to the object pointed by it, show the underlying
63         ref pointed by it when showing a symbolic ref.  Currently,
64         upload-pack only shows the symref HEAD, so it will be the only
65         one shown by ls-remote.
67 --sort=<key>::
68         Sort based on the key given. Prefix `-` to sort in descending order
69         of the value. Supports "version:refname" or "v:refname" (tag names
70         are treated as versions). The "version:refname" sort order can also
71         be affected by the "versionsort.suffix" configuration variable.
72         See linkgit:git-for-each-ref[1] for more sort options, but be aware
73         keys like `committerdate` that require access to the objects
74         themselves will not work for refs whose objects have not yet been
75         fetched from the remote, and will give a `missing object` error.
77 -o <option>::
78 --server-option=<option>::
79         Transmit the given string to the server when communicating using
80         protocol version 2.  The given string must not contain a NUL or LF
81         character.
82         When multiple `--server-option=<option>` are given, they are all
83         sent to the other side in the order listed on the command line.
85 <repository>::
86         The "remote" repository to query.  This parameter can be
87         either a URL or the name of a remote (see the GIT URLS and
88         REMOTES sections of linkgit:git-fetch[1]).
90 <patterns>...::
91         When unspecified, all references, after filtering done
92         with --heads and --tags, are shown.  When <patterns>... are
93         specified, only references matching one or more of the given
94         patterns are displayed. Each pattern is interpreted as a glob
95         (see `glob` in linkgit:gitglossary[7]) which is matched against
96         the "tail" of a ref, starting either from the start of the ref
97         (so a full name like `refs/heads/foo` matches) or from a slash
98         separator (so `bar` matches `refs/heads/bar` but not
99         `refs/heads/foobar`).
101 OUTPUT
102 ------
104 The output is in the format:
106 ------------
107 <oid> TAB <ref> LF
108 ------------
110 When showing an annotated tag, unless `--refs` is given, two such
111 lines are shown: one with the refname for the tag itself as `<ref>`,
112 and another with `<ref>` followed by `^{}`. The `<oid>` on the latter
113 line shows the name of the object the tag points at.
115 EXAMPLES
116 --------
118 * List all references (including symbolics and pseudorefs), peeling
119   tags:
121 ----
122 $ git ls-remote
123 27d43aaaf50ef0ae014b88bba294f93658016a2e        HEAD
124 950264636c68591989456e3ba0a5442f93152c1a        refs/heads/main
125 d9ab777d41f92a8c1684c91cfb02053d7dd1046b        refs/heads/next
126 d4ca2e3147b409459955613c152220f4db848ee1        refs/tags/v2.40.0
127 73876f4861cd3d187a4682290ab75c9dccadbc56        refs/tags/v2.40.0^{}
128 ----
130 * List all references matching given patterns:
132 ----
133 $ git ls-remote http://www.kernel.org/pub/scm/git/git.git master seen rc
134 5fe978a5381f1fbad26a80e682ddd2a401966740        refs/heads/master
135 c781a84b5204fb294c9ccc79f8b3baceeb32c061        refs/heads/seen
136 ----
138 * List only tags matching a given wildcard pattern:
140 ----
141 $ git ls-remote --tags http://www.kernel.org/pub/scm/git/git.git v\*
142 485a869c64a68cc5795dd99689797c5900f4716d        refs/tags/v2.39.2
143 cbf04937d5b9fcf0a76c28f69e6294e9e3ecd7e6        refs/tags/v2.39.2^{}
144 d4ca2e3147b409459955613c152220f4db848ee1        refs/tags/v2.40.0
145 73876f4861cd3d187a4682290ab75c9dccadbc56        refs/tags/v2.40.0^{}
146 ----
148 SEE ALSO
149 --------
150 linkgit:git-check-ref-format[1].
154 Part of the linkgit:git[1] suite