Advertisement

How to delete git tags on github/gitlab?

 (Read 1963 times)

Skyla157

  • Global Moderator
  • Hero Member
  • ****
  • Posts: 23756
How to delete git tags on github/gitlab?
« on: Dec 30, 2021, 08:27 PM »
When you create tags on your git for tracking or release purpose, you don't always have a successful build or deployment. Or you may just be new and have created unnecessary tags when you were just getting started and they have become messy. Then you may want to clear out those tags so you git is clean and professional.

Screenshot of a remove of git tags from local and remote repositories

If you have your git hosted on github or gitlab, you will have setup remotes with name origin in your repository. You can check your get remotes with the command 'git remote -v'. This will list the remote repositories your git can push and pull the code. These remote-names are referenced later to remove tags from them as well.

So if you want to delete your tags, first start with your local repository. For that run the command

Code: [Select]
git tag -d <tagname>
Example:
Code: [Select]
git tag -d v1.0

For the remote repositories, this command is used for deleting tags.

Code: [Select]
git push --delete <remote-name> <tagname>
Example:
Code: [Select]
git push --delete origin v1.0
You will have to repeat the command if have more remote repositories linked in your git.