Delete multiple git remote tags and push once

后端 未结 5 1155
遇见更好的自我
遇见更好的自我 2021-01-30 18:11

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.

5条回答
  •  再見小時候
    2021-01-30 18:39

    if you have too many tags (like in our case) you might want to do it like:

    git tag -l > tags_to_remove.txt
    

    then edit the file in your preferred editor - to review and remove the tags you want to keep (if any) and then run it locally

    git tag -d $(cat ./tags_to_remove.txt)
    

    and remotely:

    git push -d origin $(cat ./tags_to_remove.txt)
    

提交回复
热议问题