This is something I can never remember so…

This is something I can never remember, so why not create a small post about it.

git tag -d v1.2.3
git push origin :refs/tags/v1.2.3

So what’s this… The first line is quite obviously deleting the tag from the local working tree. The second line deletes the tag from origin in the same way as you would delete a branch on origin, by pushing noting to it’s destination.

To be complete here’s how you would delete a remote branch from origin:

git push origin :my-branch