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
To add or create an annotated tag, gather or decide on
nameof the tag, e.g. the version number
messagedescribing the tag
commithash, or make sure the repo’s HEAD is at the commit you want to tag.
git tag -a -m 'first release' v1.0.0
The tag will only existing in the local repo. To distribute the tag, it must be pushed.
git push --tags
To see all tags in a repo, run
Deleting a tag
To delete a tag run
git tag -d v1.0.0
Before doing this, consider how the tag is being used and whether a new tag is more appropriate.
- Git Basics - Tagging
git tag --helpcommand line help.