Software, Development, and WordPress

Quick Tip: Delete a Git Tag

As much as I love GitBox, it doesn’t actually provide the ability to delete tags from within the interface:

GitBox and The WordPress Plugin Boilerplate

GitBox and The WordPress Plugin Boilerplate

Sad, right?

Occasionally, there are times in which I need to remove a tag because I need to go back and make some final adjustments to a commit prior to pushing to my current branch (which is usually just `master` anyway).

This means that I need to hop over into Terminal to issue a few git commands in order to delete a Git tag from the command line.

Let’s say that you have a tag called 3.0 that you want to rollback. Luckily, this is a simple matter of issuing the following commands:

git tag -d 3.0
git push origin :refs/tags/3.0

You may be prompted to enter your username and password if you haven’t already. Other than that, you’re good to go.

Your console should result in something like the following:

Deleting a Git Tag

Deleting a Git Tag in Terminal

Easy enough, right?

After this, you should be good to go to hop back into your Git client of choice.

7 Comments

  1. Rob

    I just wanted to chime in here. From what I can remember you can remove tags in gitbox in two ways:

    1) Right click on the commit that has the tag and select ‘Delete Tag’
    2) Or if you click on the cog. Switch to ‘Branches & Tags’. And delete the tags you want to remove. This screen also allows you to edit the .gitignore file, branches & remotes.

    Hope this helps!

    • Tom McFarlin

      You’re right – at least, you should be able to right-click on the tag and select delete tag, but the client will actually infinitely block because (as best as I can tell) it’s waiting for the password for the username of the repo, but it never actually presents a dialog for which

      • Rob

        Oh, I use SSH so never had an issue!
        You can overcome this by setting the remotes url like so:

        https://tom:password@github.com/tom/repo.git

        Just swap tom for your github username and password for your password.
        This stops the github from asking you for a password every time you push, which has the added benefit of making gitbox work.

Leave a Reply

© 2020 Tom McFarlin

Theme by Anders NorenUp ↑