Git
Português (Brasil) ▾Topics ▾Latest version ▾ git-tag last updated in 2.45.0

NOME

git-tag - Crie, liste, exclua or verifique um objeto tag assinado com GPG

RESUMO

git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <arquivo>] [-e]
	<nome da tag> [<commit> | <objeto>]
git tag -d <nome da tag>…​
git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]
	[--points-at <objeto>] [--column[=<opções>] | --no-column]
	[--create-reflog] [--sort=<chave>] [--format=<formato>]
	[--merged <commit>] [--no-merged <commit>] [<padrão>…​]
git tag -v [--format=<formato>] <tagname>…​

DESCRIÇÃO

Adicione uma tag de referência em refs/tags/, a menos que -d/-l/-v seja utilizado para excluir, listar ou verificar as tags.

A menos que -f seja utilizado, a tag informada não deve existir ainda.

If one of -a, -s, or -u <key-id> is passed, the command creates a tag object, and requires a tag message. Unless -m <msg> or -F <file> is given, an editor is started for the user to type in the tag message.

Caso a opção -m <msg> ou -F <arquivo> seja usada e a opção -a, -s e -u <key-id> estiverem ausentes, a opção -a é obrigatória.

Caso contrário, é criada uma tag de referência que aponte diretamente para o objeto informado (ou seja, uma tag leve).

A GnuPG signed tag object will be created when -s or -u <key-id> is used. When -u <key-id> is not used, the committer identity for the current user is used to find the GnuPG key for signing. The configuration variable gpg.program is used to specify custom GnuPG binary.

Os objetos tag (criados com -a, -s ou -u) são chamados de tags "anotadas"; eles contêm uma data de criação, o nome e o e-mail do marcador, uma mensagem de marcação e uma assinatura opcional do GnuPG. Enquanto uma tag "leve" é simplesmente um nome para um objeto (geralmente um objeto commit).

As tags anotadas destinam-se ao lançamento, enquanto as tags leves (light) destinam-se aos rótulos dos objetos particulares ou temporários. Por este motivo que é predefinido que alguns comandos git para nomear os objetos (como git description) ignorem essas tags leves.

OPÇÕES

-a
--annotate

Fazendo um objeto sem assinatura, com a tad anotada

-s
--sign

Make a GPG-signed tag, using the default e-mail address’s key. The default behavior of tag GPG-signing is controlled by tag.gpgSign configuration variable if it exists, or disabled otherwise. See git-config[1].

--no-sign

Substitua a variável de configuração tag.gpgSign que está configurada para impor a obrigatoriedade da assinatura de cada tag.

-u <key-id>
--local-user=<key-id>

Fazer uma tag assinada por GPG utilizando a chave informada.

-f
--force

Substituir uma tag existente com um determinado nome (em vez de falhar)

-d
--delete

Excluir as tags existentes com os nomes informados.

-v
--verify

Verifique a assinatura GPG com os nomes informados.

-n<num>

O <num> determina a quantidade das linhas de anotação, caso haja, são exibidas quando utilizadas com -l. Implica no uso da opção --list.

The default is not to print any annotation lines. If no number is given to -n, only the first line is printed. If the tag is not annotated, the commit message is displayed instead.

-l
--list

Listar as tags. Com <padrão>..., exemplo, git tag --list 'v-*' liste apenas as tags que coincidam ao(s) padrões.

Executar "tag git" sem argumentos também lista todas as tags. O padrão é um curinga do shell (exemplo, quando coincidir ao usar fnmatch(3)). Padrões múltiplos podem ser informados; caso haja coincidência entre alguns deles, a tag será exibida.

Esta opção é fornecida de forma implícita caso qualquer outra lista como a opção --contains seja utilizada. Para mais detalhes consulte a documentação de cada uma dessas opções.

--sort=<chave>

Sort based on the key given. Prefix - to sort in descending order of the value. You may use the --sort=<key> option multiple times, in which case the last key becomes the primary key. Also 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. The keys supported are the same as those in git for-each-ref. Sort order defaults to the value configured for the tag.sort variable if it exists, or lexicographic order otherwise. See git-config[1].

--color[=<quando>]

Respeite todas as cores usadas com a opção --format. O campo <quando> deve ser always, never ou auto (comporte-se como always caso <quando> esteja ausente).

-i
--ignore-case

As referências de classificação e filtragem não diferenciam maiúsculas de minúsculas.

--omit-empty

Não imprima uma nova linha após a formatação das referências onde o formato se expande para a string vazia.

--column[=<opções>]
--no-column

Exiba a lista das tags em colunas. Consulte a variável de configuração column.tag para conhecer a sintaxe da opção. --column e --no-column sem opções são respectivamente o mesmo que always e never.

Esta opção é aplicável apenas ao listar as tags sem linhas de anotação.

--contains [<commit>]

Liste apenas as tags que contenham um commit em específico (HEAD`caso não esteja definido). Implica no uso da opção `--list.

--no-contains [<commit>]

Liste apenas as tags que não contenham nenhum commit em específico (HEAD`caso não esteja definido). Implica no uso da opção `--list.

--merged [<commit>]

Liste apenas as tags cujos commits sejam acessíveis de um determinado commit (`HEAD`caso não esteja definido).

--no-merged [<commit>]

Liste apenas as tags cujos commits não sejam acessíveis em um commit em específico (`HEAD`caso não esteja definido).

--points-at <objeto>

Liste apenas as tags dos objetos informados (HEAD`caso não esteja definido). Implica no uso da opção `--list.

-m <msg>
--message=<msg>

Use the given tag message (instead of prompting). If multiple -m options are given, their values are concatenated as separate paragraphs. Implies -a if none of -a, -s, or -u <key-id> is given.

-F <arquivo>
--file=<arquivo>

Take the tag message from the given file. Use - to read the message from the standard input. Implies -a if none of -a, -s, or -u <key-id> is given.

-e
--edit

The message taken from file with -F and command line with -m are usually used as the tag message unmodified. This option lets you further edit the message taken from these sources.

--cleanup=<modo>

This option sets how the tag message is cleaned up. The <mode> can be one of verbatim, whitespace and strip. The strip mode is default. The verbatim mode does not change message at all, whitespace removes just leading/trailing whitespace lines and strip removes both whitespace and commentary.

--create-reflog

Create a reflog for the tag. To globally enable reflogs for tags, see core.logAllRefUpdates in git-config[1]. The negated form --no-create-reflog only overrides an earlier --create-reflog, but currently does not negate the setting of core.logAllRefUpdates.

--format=<formato>

A string that interpolates %(fieldname) from a tag ref being shown and the object it points at. The format is the same as that of git-for-each-ref[1]. When unspecified, defaults to %(refname:strip=2).

<nome-da-tag>

The name of the tag to create, delete, or describe. The new tag name must pass all checks defined by git-check-ref-format[1]. Some of these checks may restrict the characters allowed in a tag name.

<commit>
<objeto>

The object that the new tag will refer to, usually a commit. Defaults to HEAD.

CONFIGURAÇÃO

By default, git tag in sign-with-default mode (-s) will use your committer identity (of the form Your Name <your@email.address>) to find a key. If you want to use a different default key, you can specify it in the repository configuration as follows:

[user]
    signingKey = <gpg-key-id>

pager.tag is only respected when listing tags, i.e., when -l is used or implied. The default is to use a pager. See git-config[1].

DISCUSSÃO

Sobre renomeação de tag

O que você deve fazer quando marcar um commit errado e quiser marca-lo novamente?

Caso nunca tenha impulsionado nada, basta remarcá-lo. Utilize "-f" para substituir o antigo. E pronto.

Porém caso você impulsione as coisas para fora (ou as outras pessoas apenas puderam ler o seu repositório diretamente), as outras pessoas já viram a tag antiga. Nesse caso, é possível fazer uma de duas coisas:

  1. The sane thing. Just admit you screwed up, and use a different name. Others have already seen one tag-name, and if you keep the same name, you may be in the situation that two people both have "version X", but they actually have different "X"'s. So just call it "X.1" and be done with it.

  2. The insane thing. You really want to call the new version "X" too, even though others have already seen the old one. So just use git tag -f again, as if you hadn’t already published the old one.

No entanto, o Git não (e não deve) alterar as tags sem o conhecimento dos usuários. Portanto, se alguém já recebeu a tag antiga, fazer um git pull na sua árvore não substituirá a antiga.

If somebody got a release tag from you, you cannot just change the tag for them by updating your own one. This is a big security issue, in that people MUST be able to trust their tag-names. If you really want to do the insane thing, you need to just fess up to it, and tell people that you messed up. You can do that by making a very public announcement saying:

Ok, eu estraguei tudo e impulsionei uma versão anterior com a tag X. Eu
então consertei alguma coisa e marquei novamente a árvore *corrigida* como X novamente.

Caso tenha pego a etiqueta errada e queira a nova, exclua
o antigo e buscar um novo, fazendo:

	git tag -d X
	git fetch origin tag X

para obter a minha tag atualizada.

Você pode testar qual tag você possui fazendo.

	git rev-parse X

o que também retorna 0123456789abcdef.. caso tenha a nova versão.

Perdoe a inconveniência.

Does this seem a bit complicated? It should be. There is no way that it would be correct to just "fix" it automatically. People need to know that their tags might have been changed.

Na sequência automática

If you are following somebody else’s tree, you are most likely using remote-tracking branches (eg. refs/remotes/origin/master). You usually want the tags from the other end.

On the other hand, if you are fetching because you would want a one-shot merge from somebody else, you typically do not want to get tags from there. This happens more often for people near the toplevel but not limited to them. Mere mortals when pulling from each other do not necessarily want to automatically get private anchor point tags from the other person.

Frequentemente, aparecem mensagens "please pull" na lista de discussão que oferecem apenas duas informações: uma URL do repo e um nome do ramo; foi projetado para ser facilmente cortado e colado no final de uma linha de comando git fetch:

Linus, por favor, capture de

	git://git..../proj.git master

para obter as seguintes atualizações...

se torna:

$ git pull git://git..../proj.git master

Em casos assim, você não quer seguir automaticamente as tags da outra pessoa.

One important aspect of Git is its distributed nature, which largely means there is no inherent "upstream" or "downstream" in the system. On the face of it, the above example might seem to indicate that the tag namespace is owned by the upper echelon of people and that tags only flow downwards, but that is not the case. It only shows that the usage pattern determines who are interested in whose tags.

A one-shot pull is a sign that a commit history is now crossing the boundary between one circle of people (e.g. "people who are primarily interested in the networking part of the kernel") who may have their own set of tags (e.g. "this is the third release candidate from the networking group to be proposed for general consumption with 2.6.21 release") to another circle of people (e.g. "people who integrate various subsystem improvements"). The latter are usually not interested in the detailed tags used internally in the former group (that is what "internal" means). That is why it is desirable not to follow tags automatically in this case.

It may well be that among networking people, they may want to exchange the tags internal to their group, but in that workflow they are most likely tracking each other’s progress by having remote-tracking branches. Again, the heuristic to automatically follow such tags is a good thing.

Sobre as Tags com Datas Retroativas

Caso tenha importado algumas alterações de outro VCS e queira adicionar as tags para as principais versões do seu trabalho, é útil poder informar a data que será incorporada no objeto tag; estes dados no objeto tag afetam, por exemplo, a ordem das tags na interface gitweb.

Para definir a data usada em objetos com tags futuras, defina a variável de ambiente GIT_COMMITTER_DATE (consulte a discussão posterior sobre os valores possíveis; a forma mais comum é "AAAA-MM-DD HH:MM").

Por exemplo:

$GIT_COMMITTER_DATE="2006-10-02 10:31" git tag -s v1.0.1

OS FORMATOS DA DATA

As variáveis de ambiente GIT_AUTHOR_DATE e GIT_COMMITTER_DATE são compatíveis com os seguintes formatos de data:

Formato interno do Git

É <unix-timestamp> <time-zone-offset>, onde desde a época do UNIX <unix-timestamp> é o valor em segundos. O <time-zone-offset> é o desvio positivo ou negativo a partir do UTC. O CET por exemplo (onde é 1 hora à frente do UTC ) é +0100.

RFC 2822

O formato de e-mail padrão, conforme descrito pela RFC 2822, por exemplo, Thu, 07 Apr 2005 22:13:13 +0200.

ISO 8601

A data e hora definidas pela norma ISO 8601 2005-04-07T22:13:13 por exemplo. O analisador também aceita um espaço em vez do caractere T. O analisador aceita um espaço em vez do caractere T também. As partes fracionadas de um segundo serão ignoradas, logo 2005-04-07T22:13:13.019 por exemplo, será tratada como 2005-04-07T22:13:13.

Note
Além disso, a parte da data é aceita nos seguintes formatos: YYYY.MM.DD, MM/DD/YYYY e DD.MM.YYYY.

ARQUIVOS

$GIT_DIR/TAG_EDITMSG

Esse arquivo contém a mensagem de uma tag anotada em andamento. Se o git tag for encerrado devido a um erro antes de criar uma tag anotada, a mensagem da tag que foi fornecida pelo usuário numa sessão do editor estará disponível nesse arquivo, mas poderá ser substituída pela próxima chamada do comando git tag.

OBSERVAÇÕES

Ao combinar diversos filtros a opção --contains e a opção --no-contains, faz referências apenas aos que contenha pelo menos um dos commits --contains e não contenha nenhum dos commits mostrados com --no-contains.

Ao combinar diversos filtros a opção --merged e a opção --no-merged, faz referências apenas aos que sejam acessíveis a partir um dos commits --merged e de nenhum dos commits mostrados com --no-merged.

GIT

Parte do conjunto git[1]

scroll-to-top