Undo tag that's not pushed in Git
Asked Answered
E

1

22

I've made a commit and a tag (using git tag -a -m ). I found out before I pushed that I needed to revert the commit so I used git revert --soft HEAD~. How do I also remove the tag? I've checked with git push --tags --dry-run that it hasn't been pushed yet, so I hope it's possible to remove.

Epifaniaepifano answered 2/6, 2016 at 10:21 Comment(1)
There is no --soft flag for git revert. Did you mean git reset?Kindness
M
34

Just run the following command from the branch where you created the tag:

git tag -d <tag name>

Even if you pushed the tag already it is still possible to remove it. Check out this useful blog post.

Mccreary answered 2/6, 2016 at 10:26 Comment(1)
In case that (very helpful) blog post goes away, the syntax for deleting the remote tag is: git push origin :refs/tags/<tag name>Cumuliform

© 2022 - 2024 — McMap. All rights reserved.