Difference between revisions of "Git, Tagging"

From Wiki de Caballero
Jump to navigation Jump to search
m (Felipe moved page Git, Tagging y Branching to Git, Tagging without leaving a redirect)
Line 1: Line 1:
Para entender sobre Git, leer previamente [[Git, lo Básico]].
Para entender sobre Git, leer previamente [[Git, lo Básico]].


==Tagging==
Los ''tags'' son referencias a un ''commit'' en particular, pueden ser útiles por ejemplo para hacer referencia a una versión del desarrollo (e.g. 1.3.2).
Los ''tags'' son referencias a un ''commit'' en particular, pueden ser útiles por ejemplo para hacer referencia a una versión del desarrollo (e.g. 1.3.2).


Existen dos tipos de ''tags''. Primero, ''lightweight'' que funcionan como un puntero a un objeto de Git pero no guardan información adicional. Segundo, ''annotaded'' que son guardados como objetos completos de Git y contienen información como nombre del ''tagger'' (quien hace el ''tag''), e-mail, fecha y tienen un mensaje. En el [http://git-scm.com/book/en/Git-Basics-Tagging#Creating-Tags libro oficial] recomiendan usar ''annotaded tags''.
Existen dos tipos de ''tags''. Primero, ''lightweight'' que funcionan como un puntero a un objeto de Git pero no guardan información adicional. Segundo, ''annotaded'' que son guardados como objetos completos de Git y contienen información como nombre del ''tagger'' (quien hace el ''tag''), e-mail, fecha y tienen un mensaje. En el [http://git-scm.com/book/en/Git-Basics-Tagging#Creating-Tags libro oficial] recomiendan usar ''annotaded tags''.


===Lightweight Tags===
==Lightweight Tags==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
git tag nombreTag
git tag nombreTag
</syntaxhighlight>
</syntaxhighlight>


===Anotaded Tags===
==Anotaded Tags==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
git tag -a nombreTag -m 'Mensaje del tag'
git tag -a nombreTag -m 'Mensaje del tag'
</syntaxhighlight>
</syntaxhighlight>


===Listar tags===
==Listar tags==
<div class="toccolours mw-collapsible mw-collapsed" style="width:800px">
<div class="toccolours mw-collapsible mw-collapsed" style="width:800px">
Listar todos los tags
Listar todos los tags
Line 46: Line 45:
</div></div>
</div></div>


===Tag un commit anterior===
==Tag un commit anterior==
Para hacer un ''tag'' sobre un ''commit'' anterior se usa, después del comando, el ''checksum'' del ''commit'' (o una parte) que se quiere usar. Funciona igual para ''lightweight'' o ''annotaded'' ''tags''. Ej:
Para hacer un ''tag'' sobre un ''commit'' anterior se usa, después del comando, el ''checksum'' del ''commit'' (o una parte) que se quiere usar. Funciona igual para ''lightweight'' o ''annotaded'' ''tags''. Ej:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 52: Line 51:
</syntaxhighlight>
</syntaxhighlight>


===Quitar un tag===
==Quitar un tag==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
git tag rm nombreTag
git tag rm nombreTag
</syntaxhighlight>
</syntaxhighlight>


===Subir tags a un remote===
==Subir tags a un remote==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
git push nombreRemote nombreTag # Sube nombreTag a nombreRemote
git push nombreRemote nombreTag # Sube nombreTag a nombreRemote

Revision as of 03:01, 12 November 2013

Para entender sobre Git, leer previamente Git, lo Básico.

Los tags son referencias a un commit en particular, pueden ser útiles por ejemplo para hacer referencia a una versión del desarrollo (e.g. 1.3.2).

Existen dos tipos de tags. Primero, lightweight que funcionan como un puntero a un objeto de Git pero no guardan información adicional. Segundo, annotaded que son guardados como objetos completos de Git y contienen información como nombre del tagger (quien hace el tag), e-mail, fecha y tienen un mensaje. En el libro oficial recomiendan usar annotaded tags.

Lightweight Tags

git tag nombreTag

Anotaded Tags

git tag -a nombreTag -m 'Mensaje del tag'

Listar tags

Listar todos los tags

Este comando lista los tags disponibles

git tag

Resultado:

v1
v1.3
v1.5

Listar tags usando filtro

Este comando lista los tags disponibles

git tag -l 'v1.*' # Lista solamente los tags que empiezan con v1.

Resultado:

v1.3
v1.5

Tag un commit anterior

Para hacer un tag sobre un commit anterior se usa, después del comando, el checksum del commit (o una parte) que se quiere usar. Funciona igual para lightweight o annotaded tags. Ej:

git tag -a nombreTag -m 'Mensaje del tag' 1132c1f

Quitar un tag

git tag rm nombreTag

Subir tags a un remote

git push nombreRemote nombreTag	# Sube nombreTag a nombreRemote
git push nombreRemote --tags	# Sube todos los tags que exiten localmente a nombreRemote