« Git Commandes » : différence entre les versions

Aucun résumé des modifications
Ligne 8 : Ligne 8 :
git log -1 HEAD
git log -1 HEAD
</pre>
</pre>


==Tag==
==Tag==
===Création===
Cherche le tag le plus récent dans l'historique du commit actuel.
<pre>
<syntaxhighlight lang="bash" line copy>
git describe --tags
</syntaxhighlight>
 
=== Création ===
<syntaxhighlight lang="bash" line copy>
git tag -a v2.4.2 -m "Le message du commit"
git tag -a v2.4.2 -m "Le message du commit"
git push --tags  
git push --tags  
</pre>
</syntaxhighlight>


===Suppression===
=== Suppression ===
<pre>
<syntaxhighlight lang="bash" line copy>
git tag -d v2.4.1
git tag -d v2.4.1 # retire le tag dépôt local
git push origin :refs/tags/v2.4.1
</syntaxhighlight>
</pre>La première ligne de commande retire le tag dépôt local. La deuxième retire le tag du repo distant
<syntaxhighlight lang="bash" line copy>
===Voir===
git push origin :refs/tags/v2.4.1 # retire le tag du repo distant
<pre>
</syntaxhighlight>
=== Voir ===
<syntaxhighlight lang="bash" line copy>
git show v2.4.1
git show v2.4.1
git describe Les-bases-de-Git-Travailler-avec-des-dépôts-distantsags
</pre>
</pre>
===Renommer===
=== Renommer ===
<pre>
<syntaxhighlight lang="bash" line copy>
git tag v1.0.2 v1.0.2^{} -f -m "intégration du menu et reponsive"
# conversion en tag annoté avec message
git tag v1.0.2 v1.0.2^{} -f -m "message détaillé"
# Efface tous les tags distants non présents localement.
# Peut écraser des tags créés par d'autres sans garde-fou.
git push -f origin --tags
git push -f origin --tags
</pre>
</pre>
===Renommer (Alternative moins risquée) ===
<syntaxhighlight lang="bash" line copy>
# 1. Mise à jour locale du tag
git tag -fa v1.0.2 -m "Nouveau message"
# 2. Suppression du tag distant
git push origin :v1.0.2
# 3. Push du nouveau tag
git push origin v1.0.2
</syntaxhighlight>


== Dépot ==
== Dépot ==