Git
Português (Brasil) ▾Topics ▾Latest version ▾ git-ls-remote last updated in 2.42.0

NOME

git-ls-remote - Liste referências num repositório remoto

RESUMO

git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]
	      [-q | --quiet] [--exit-code] [--get-url] [--sort=<chave>]
	      [--symref] [<repositório> [<padrões>…​]]

DESCRIÇÃO

Exibe as referências disponíveis num repositório remoto, juntamente com as IDs os commits associados.

OPÇÕES

-h
--heads
-t
--tags

Limit to only refs/heads and refs/tags, respectively. These options are not mutually exclusive; when given both, references stored in refs/heads and refs/tags are displayed. Note that git ls-remote -h used without anything else on the command line gives help, consistent with other git subcommands.

--refs

Não exiba as opções removidas ou as pseudorefs como HEAD na saída.

-q
--quiet

Não exiba a URL remota no stderr.

--upload-pack=<exec>

Define o caminho completo do git-upload-pack no host remoto. Permite listar as referências dos repositórios acessados através do SSH e onde o daemon SSH não utiliza o PATH configurado pelo usuário.

--exit-code

Encerra com a condição 2 quando nenhuma refs coincidente for encontrada no repositório remoto. Normalmente, o comando encerra com a condição 0 para indicar que houve uma comunicação bem sucedida com o repositório remoto, caso tenha encontrado qualquer refs coincidentes.

--get-url

Expanda a URL do repositório remoto informado, levando em consideração qualquer definição da configuração "url.<base>.insteadOf" (consulte git-config[1]) e encerre sem se comunicar com o repositório remoto.

--symref

In addition to the object pointed by it, show the underlying ref pointed by it when showing a symbolic ref. Currently, upload-pack only shows the symref HEAD, so it will be the only one shown by ls-remote.

--sort=<chave>

Sort based on the key given. Prefix - to sort in descending order of the value. Supports "version:refname" or "v:refname" (tag names are treated as versions). The "version:refname" sort order can also be affected by the "versionsort.suffix" configuration variable. See git-for-each-ref[1] for more sort options, but be aware keys like committerdate that require access to the objects themselves will not work for refs whose objects have not yet been fetched from the remote, and will give a missing object error.

-o <opção>
--server-option=<opção>

Transmit the given string to the server when communicating using protocol version 2. The given string must not contain a NUL or LF character. When multiple --server-option=<option> are given, they are all sent to the other side in the order listed on the command line.

<repositório>

The "remote" repository to query. This parameter can be either a URL or the name of a remote (see the GIT URLS and REMOTES sections of git-fetch[1]).

<padrões>…​

When unspecified, all references, after filtering done with --heads and --tags, are shown. When <patterns>…​ are specified, only references matching one or more of the given patterns are displayed. Each pattern is interpreted as a glob (see glob in gitglossary[7]) which is matched against the "tail" of a ref, starting either from the start of the ref (so a full name like refs/heads/foo matches) or from a slash separator (so bar matches refs/heads/bar but not refs/heads/foobar).

SAÍDA

O resultado será no formato:

<oid> TAB <ref> LF

Ao exibir uma etiqueta anotada, a menos que a opção --refs seja usada, duas dessas linhas são exibidas: uma com o nome de referência da própria tag como <ref> e outra com <ref> seguido de ^{}. O <oid> na última linha mostra o nome do objeto para o qual a tag aponta.

EXEMPLOS

  • Liste todas as referências (inclusive simbólicas e pseudo referências), removendo as etiquetas:

    $ git ls-remote
    27d43aaaf50ef0ae014b88bba294f93658016a2e	HEAD
    950264636c68591989456e3ba0a5442f93152c1a	refs/heads/main
    d9ab777d41f92a8c1684c91cfb02053d7dd1046b	refs/heads/next
    d4ca2e3147b409459955613c152220f4db848ee1	refs/tags/v2.40.0
    73876f4861cd3d187a4682290ab75c9dccadbc56	refs/tags/v2.40.0^{}
  • Lista todas as referências que correspondam com os padrões fornecidos:

    $ git ls-remote http://www.kernel.org/pub/scm/git/git.git master seen rc
    5fe978a5381f1fbad26a80e682ddd2a401966740	refs/heads/master
    c781a84b5204fb294c9ccc79f8b3baceeb32c061	refs/heads/seen
  • Lista apenas as etiquetas que correspondam a um determinado curinga padrão:

    $ git ls-remote --tags http://www.kernel.org/pub/scm/git/git.git v\*
    485a869c64a68cc5795dd99689797c5900f4716d	refs/tags/v2.39.2
    cbf04937d5b9fcf0a76c28f69e6294e9e3ecd7e6	refs/tags/v2.39.2^{}
    d4ca2e3147b409459955613c152220f4db848ee1	refs/tags/v2.40.0
    73876f4861cd3d187a4682290ab75c9dccadbc56	refs/tags/v2.40.0^{}

GIT

Parte do conjunto git[1]

scroll-to-top