简体   繁体   中英

Remove all git tags expect a custom list of git tags?

Im trying to write a bash script that asks you for how many tags you want to keep and afterwards you can enter the tags you want to keep. Next the script should remove all remote git tags expect the ones entered before. But how can I achieve this? Thanks in advance

You can use git tag to retrieve all tags in a repository

Then you will have to loop over these tags and if it does not match any of the given tags, remove it using the following git command :

git push --delete origin tagname

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM