git tag marks a specific commit in the source repository. A common use case is to denote software release versions by marking the points of commit history where the software was stable to release.
git taggives the list of all tags.git tag <tagname>creates a tag named tagname. This tag points to the commit that was HEAD at the time of tag creation.- Tags can be made to point to any commit, not just HEAD.
- Tags are not pushed to the remote by default. Use
git push <remotename> <tagname>to push one. - To push all tags at once:
git push <remotename> --tags git tag -d <tagname>deletes a tag from the repo.- There are two types of tags: lightweight and annotated. Lightweight tags have only a name. Annotated tags contain additional metadata — the author's name, email, and an annotation message. By default
git tag <tagname>creates a lightweight tag. To create an annotated tag:git tag -a -m "annotation msg" <tagname>.