REF.: Git Book - 2.6 Git Basics - Tagging
git tag <tagname>
git tag -d <tagname>
git tag <new_tagname> <old_tagname>
git push origin <new_tagname> :<old_tagname>
Note: The colon :
removes the tag from the remote repository. Everyone else needs to update locally as well with git pull --prune --tags
.
# Replaces an existing tag with the same name and adds a message
git tag <tagname> <tagname>^{} -f -m "<new message>"
git tag [--list or -l]
# or list with optional string pattern
git tag -l <pattern>
# or list with commit message
git tag -n
# Tag a specific commit hash (with annotation)
git tag -a <tagname> 9fceb02
# ... (without annotation, a light-weight tag)
git tag <tagname> 9fceb02
git push origin <tagname>
# or sharing all tags at once
git push origin --tags
# not recommended; this might trigger unwanted actions (!)
git push origin --delete <tagname>