How to Delete a Local Git Tag?

You can delete a Git tag locally by using the git tag command with the -d flag (or --delete), for example, like so:

git tag -d <tag-name>

Please note that this does not affect tags on your remote. Depending on your Git version, you may have to use a different git command to remove a tag from your remote repository.

If the tag is successfully deleted, you will see an output similar to the following:

Deleted tag 'v1.5.0' (was 80c6ed6)

If the tag you're trying to delete does not exist locally, then it will result in the following error:

error: tag 'v1.5.0' not found.

You can also list all local tags using the following command to verify if tags have been deleted locally:

git tag

For example, to delete a tag named "v1.5.0", you would run the following command:

git tag -d v1.5.0

This post was published (and was last revised ) by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.