How to delete a local tag in GIT


To delete a local tag in Git, you can use the git tag -d command followed by the name of the tag. Here are the steps:

  • Open a terminal or command prompt and navigate to the Git repository that contains the tag you want to delete.
  • Use the git tag command to list all of the tags that currently exist in the repository. Find the name of the tag that you want to delete.
git tag
  • Use the git tag -d command followed by the name of the tag to delete it. For example, to delete a tag named v1.0.0, use the following command:This will delete the local tag named v1.0.0
git tag -d v1.0.0
  • Use the git tag command again to verify that the tag has been deleted:The deleted tag should no longer appear in the list.
git tag

Note that deleting a local tag does not delete the corresponding tag on remote repositories. If you want to delete a tag on a remote repository, you need to use the git push command with the --delete option followed by the name of the tag. For example, to delete a remote tag named v1.0.0 on the origin remote, use the following command:

git push origin --delete v1.0.0