Search code examples
gittags

Delete multiple git remote tags and push once


In Git, how can I delete multiple tags before pushing?

I know how to do it with one tag at a time. Not sure if it's possible to do multiple.


Solution

  • To delete locally multiple tags: git tag:

    git tag -d <tagname>...

    So simply:

    git tag -d TAG1 TAG2 TAG3
    

    To delete multiple tags remotely: git push:

    git push [-d | --delete] [<repository> [<refspec>...]]

    So simply:

    git push ${REMOTE_NAME:-origin} --delete TAG1 TAG2 TAG3
    

    TL;DR:

    git tag -d TAG1 TAG2 TAG3
    git push origin -d TAG1 TAG2 TAG3