Git tags
A tag points to a specific commit in a repository. It is often used to label a release or version of code, so that it may be referred to later.
An annotated tag also contains a date, tagger and message. A lightweight tag only includes the commit.
Creating a tag
Section titled “Creating a tag”To add or create an annotated tag, gather or decide on
- The
nameof the tag, e.g. the version number - A
messagedescribing the tag - The
commithash, or make sure the repo’s HEAD is at the commit you want to tag.
Then run
git tag -a -m 'first release' v1.0.0The tag will only existing in the local repo. To distribute the tag, it must be pushed.
git push --tagsListing tags
Section titled “Listing tags”To see all tags in a repo, run
git tagDeleting a tag
Section titled “Deleting a tag”To delete a tag run
git tag -d v1.0.0Before doing this, consider how the tag is being used and whether a new tag is more appropriate.
References
Section titled “References”- Git Basics - Tagging
git tag --helpcommand line help.