Techtrekking

How to delete tag locally and from GitHub

By Pravin

To delete a Git tag, you must usually remove it in two places:

  1. Local repository
  2. Remote repository (GitHub)

1. Delete a Tag Locally

First check existing tags:

git tag

Delete a specific tag:

git tag -d <tag-name>

Example:

git tag -d v1.2.0

Result: The tag is removed only from your local machine.


2. Delete the Tag from GitHub (Remote)

To remove it from GitHub:

git push origin --delete <tag-name>

Example:

git push origin --delete v1.2.0

3. Complete Workflow

git tag -d v1.2.0 git push origin --delete v1.2.0

4. Verify

Local

git tag

Remote

git ls-remote --tags origin

5. If the Tag Was Already Pulled by Others

Other developers may still have the tag locally. They must run:

git fetch --prune --tags

or delete manually:

git tag -d v1.2.0

6. Deleting Multiple Tags

Local:

git tag -d tag1 tag2 tag3

Remote:

git push origin --delete tag1 tag2 tag3

If you want, I can also explain the difference between Git tags, GitHub releases, and version tags used in CI/CD, because many teams mix them incorrectly.

Comments
No comments yet. Be the first to comment!
Leave a Comment
Your comment will be visible after approval.