Adding and Removing Tags on GitHub

If you’ve accidentally committed a tag and pushed it up to GitHub, it’s quite easy to delete it and then add a new one. For this example, I’m deleting my previous tag “v1.0”, and then adding a new one for the repo at its current state.

1) Delete the v1.0 tag locally:

git tag -d v1.0

2) Delete the v1.0 tag on GitHub (which removes its download link):

git push origin :v1.0

3) Add a new tag for the updated release:

git tag -a v1.0 -m "Version 1.0 Stable"

4) Push the latest tag to GitHub (two dashes):

git push --tags

About Devin

I am a developer based in Austin, Texas. I run a little theme shop called DevPress and help manage a WooCommerce shop with Universal Yums. Find me on twitter @devinsays.

12 Responses

  1. Ben

    Ha! Just found a use for this, thanks! (I accidently tagged a repo before committing some changes, so the tagged version wasn’t correct. Just deleted and then re-tagged it – quite handy!)

      1. Ben Carter

        Not really the same one infers a link to some reference by that name be it a branch or tag. If you have a branch and tag with the same name it will not work.

  2. Chris

    This just solved a frustrating issue I had with deleting remote tags – thanks for posting (even though it was a while ago).

  3. Eric

    Since the tag being deleted (locally and remotely) is supposed to be “v1.0”, shouldn’t the second step reference v1.0 instead of v0.4? For example:
    git push origin :v1.0

  4. Santosh Yadav

    Can any one tell me proper way of creating tags. As per my requirement I want to create tag with some name V1. And in that tag V1, I want to commit and push changes made by developer. Is it possible. Or I am going in wrong direction.

Leave a Reply to Eric Cancel reply