Difference between revisions of "Git, Tagging"

From Wiki de Caballero
Jump to navigation Jump to search
Line 1: Line 1:
Para entender sobre Git, leer previamente [[Git, lo Básico]].
==Tagging==
==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).
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===
<syntaxhighlight lang="bash">
git tag nombreTag
</syntaxhighlight>
===Anotaded Tags===
<syntaxhighlight lang="bash">
git tag -a nombreTag -m 'Mensaje del tag'
</syntaxhighlight>
===Listar tags===
<div class="toccolours mw-collapsible mw-collapsed" style="width:800px">
Listar todos los tags
<div class="mw-collapsible-content">
Este comando lista los tags disponibles
<syntaxhighlight lang="bash">
git tag
</syntaxhighlight>
Resultado:
<syntaxhighlight lang="bash">
v1
v1.3
v1.5
</syntaxhighlight>
</div></div>
<div class="toccolours mw-collapsible mw-collapsed" style="width:800px">
Listar tags usando filtro
<div class="mw-collapsible-content">
Este comando lista los tags disponibles
<syntaxhighlight lang="bash">
git tag -l 'v1.*' # Lista solamente los tags que empiezan con v1.
</syntaxhighlight>
Resultado:
<syntaxhighlight lang="bash">
v1.3
v1.5
</syntaxhighlight>
</div></div>
===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:
<syntaxhighlight lang="bash">
git tag -a nombreTag -m 'Mensaje del tag' 1132c1f
</syntaxhighlight>
===Quitar un tag===
<syntaxhighlight lang="bash">
git tag rm nombreTag
</syntaxhighlight>
===Subir tags a un remote===
<syntaxhighlight lang="bash">
git push nombreRemote nombreTag # Sube nombreTag a nombreRemote
git push nombreRemote --tags # Sube todos los tags que exiten localmente a nombreRemote
</syntaxhighlight>


==Branching==
==Branching==


[[Category: Git]]
[[Category: Git]]

Revision as of 21:33, 11 November 2013

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).

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

Branching