列出 git 个标签,不包括标题中的单词

List git tags excluding word in title

我需要删除所有标签,不包括以“AppStore”结尾的标签。 我知道我可以像这样按单词过滤删除标签:

git tag -d $(git tag -l "1.158*")

但我不知道如何制作排除模式。 我试过这个:

git tag -l "!*AppStore"

此模式在数字海洋 glob 测试工具中运行良好:shorturl.at/yOR69 但终端 returns 没有。

我也试过这个:

git tag -l "!(*AppStore)"

git tag -l "*!(AppStore)"

但结果是一样的

有谁知道如何完成这个任务吗?

很难一次完成很多事情 - 分开做小部件然后将它们连接起来更容易。尝试先列出所有标签,然后过滤列表,然后删除标签。

git tag | grep -v 'AppStore$' | xargs git tag -d