- Tags are pointers that refer to particular points in Git history. We can mark a particular moment in time with a tag.
- Tags are most often used to mark version releases in projects (v4.1.0, v4.1.1, etc.)
- There are two types of Git tags we can Use: lightweight
and annotated tags
Lightweight tags:
- lightweight tags are...lightweight. They are just a
name/ label that points to a particular commit.
- You can create a light weight tag using git tag <tag>
Annotated tags:
- annotated tags store extra meta data including the
author's name and email, the date, and a tagging message (like a commit message)
- You can create a annotated tag using git tag -a <tag>. You can also pass message directly using -m. Use git show <tag> to show the meta data associated with that tag.
- git tag will print all the list of tags in the current repo.
- You can use git tag -l “beta” to search for tags that include beta in their name.
- You can also checkout using git tags —> git checkout 15.3.1
Tag Previous Commits:
- git tag <tag name> <commit>
Delete Tags:
Push Tags:
- By default, the git push command doesn't transfer tags to remote servers. If YOU have a lot of tags that you want to push UP at once, YOU can Use the --tags option to the git push command. This will transfer all of your tags to the remote server that are not already there.
- git push —tags