Tags work as an additional identifier for a particular incident. And in the case of Git, Tags are used as the reference points in your development workflow and it denotes special events like a new version release or new commit. You can create a new tag to give a reference for your newly launched version.
We use tags for future reference of our previous releases and commits. And we can create and delete as per our convenience.
- To delete a tag from a local repository, We can use the “git tag -d” command followed by the tag name you want to delete. For example:
git tag -d [tagName]
So if you want to delete a tag v1.4 then you can execute:
git tag -d v1.4
- To delete tags from the remote repository, Execute the following command:
git push origin --delete origin [tagName]
- You can also use the git push command to delete a tag by specifying the tag name by refs syntax.
git push origin :refs/tags/[tagName]
- If you want to check if your tags have been deleted or not then you can list them all using “-l”
git tag -l