Git delete a remote/local branch or tag
A lot of people keep asking me on Skype or chat how to delete a remote branch/tag in git, so I decided to put it in a nice little article, so I can refer it to them.
If you want to delete a local tag then you would do
git tag -d <tag name>
But if you want to delete remote tag, then the syntax is a little different
git push origin :refs/tags/<tag name>
This will delete the tag on the remote origin.
Now let’s see how to delete a local branch,
git branch -d <branch name>
And now for a remote branch,
git push origin :<branch name>
Or since version 1.7.0 now you can delete the branch like so.
git push origin --delete <branch name>