Jules
Jules

Reputation: 3145

How to delete more than one tag?

I have a bunch of tags in my Git repository. Is it somehow possible to not delete every single tag but all tags which starts with some typical pattern?

I'd like to delete all tags which start with v1.xxx but not those which start with v2.xxx.

I don't want to delete all tags with:

git tag -l | xargs git tag -d

I'd rather want to do something like:

git tag --delete v1.*
git push --delete origin v1.*

Any suggestions?

UPDATE - How can I push more than one tag on remote?

Upvotes: 3

Views: 2542

Answers (1)

Tanmay Vats
Tanmay Vats

Reputation: 429

Via Linux command you can delete multiple GIT Tags by separating with PIPE (|)

git tag | xargs git tag -d

Or you can delete all tags in the local repository:

git tag -d `git tag | grep -E '.'`

And, you can delete all tags that ends with _test

git tag -d `git tag | grep -E '^*\._test$'`

Yet another way:

git tag | ag *_test | xargs git tag -d

(using ag)

Upvotes: 7

Related Questions