10

In our company we use Git tags to trigger production builds. I just created a tag locally with

git tag -m "Tag message"

but realize I've made a typo mistake, which will mess up with the production build if I share the tag (push it to remote).

Can I remove or amend the tag as I would be able to do with commits? I haven't pushed the tag to the remote repository yet.

Wallace Sidhrée
  • 11,221
  • 6
  • 47
  • 58
  • Thanks for pointing in a good direction, but @Xetius answer adds up nicely to the post you've mentioned, which doesn't say anything on how to remove/delete tags. In that sense, this question is not a duplicate (if you ask me). ;) – Wallace Sidhrée May 28 '14 at 10:04
  • http://git-scm.com/docs/git-tag is very clear on how to delete a tag. I assumed you had already checked the docs before asking your question – Tim May 28 '14 at 10:53
  • 1
    @TimCastelijns this is not an exact duplicate of that other question, in my opinion, this question also asks how to remove tags, not just how to edit them. Also, the original poster is using lightweight tags here, while the other question uses annotated tags. I'll have to look up later if that makes a difference for editing them, and stuff like that. –  Jul 31 '14 at 04:47

1 Answers1

26

Delete a local tag with

git tag -d tag_name

Delete a remote tag with

git push origin :refs/tags/tag_name

However, the command git tag -m "Tag message" wont work as you aren't supplying a tag name. You may find that you haven't actually created a tag yet

You can list all your tags with

git tag --list
Xetius
  • 44,755
  • 24
  • 88
  • 123
  • The tag actually had a name, but in my haste adapting the original tag to the question I ended up leaving the name out. Anyways, your answer was useful, thanks a lot! – Wallace Sidhrée May 28 '14 at 10:08