As you all know tags are used in Git to handle the releases. It helps in identifying commit points which are helpful.
This article explains the creation of tags with common options and deleting the tags with common options.
Before creating or deleting tags - make sure your tag history on your local is up to date with the remote branch.
use following to delete any unncecessary tags in your local repo:
git tag -l | xargs git tag -d git fetch
To create a new tag , just type in the following command
git tag -a -m "Your message for the tag" TagVersion
example: git tag -a -m "Release candidate - v2" v2
To delete the tag
git tag -d TagVersion
example , to delete the version v2: git tag -d v2
Once the tag is created , you have to push it to the server. Use the following command for it:
git push --tags
if you want to delete a tag on the remote branch , use the following:
first delete the tag on the local repo: git tag -d v2 and then type: git push origin :refs/tags/v2
- Written by Madhu V Rao
- Category: General Topics
- Hits: 2450