I have the list of tags from gitlab with this commande line git tag -l .
Input :
echo listTags = $(git tag -l)
listTags= v0.0.1 v0.0.2 v0.1.0 v0.1.0-1 v0.1.0-2 v0.1.0-3 v0.1.0-4 v0.1.0-5
for tag in 'git tag -l'
do
git tag -d $tag
git push -v origin :refs/tags/$tag
done
I want to remove all the oldest pre-release version and keep the 2 latest
Output:
echo listTags = $(git tag -l)
listTags= v0.0.1 v0.0.2 v0.1.0 v0.1.0-4 v0.1.0-5
how can i resolve this problem with script shell?
git tag -l | sort -V |tail -2
This command gives you the newest 2 tags
delete all tags execpt the result from that command
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.