简体   繁体   English

如何从最新到最旧排序 GitLab 标签

[英]How to order GitLab tags from latest to oldest

I have cloned recursively a repo from GitLab and then got the tags of the submodules by using the following command:我从 GitLab 递归地克隆了一个 repo,然后使用以下命令获取了子模块的标签:

git submodule foreach git tag -l

So as an example.举个例子。 I have the following submodule (components), AccltrInterLckDet listed along with all of its tags:我有以下子模块(组件),AccltrInterLckDet 及其所有标签一起列出:

Entering 'components/AccltrInterLckDet'
01.01.20210702.001
01.02.202203.001
beagledaimler.02.202211.001
legendgold.02.202210.001
octanegold.02.202210.001
titanium.02.202210.001
titanium.02.202211.001

Is there a way to order the tags from latest to oldest?有没有办法将标签从最新到最旧排序? As reference for that component when I go into GitLab and sort the tags by "Updated date", I get the following order:作为该组件的参考,当我进入 GitLab 并按“更新日期”对标签进行排序时,我得到以下顺序:

titanium.02.202211.001 
beagledaimler.02.202211.001 
titanium.02.202210.001, legendgold.02.202210.001 
octanegold.02.202210.001 
01.02.202203.001 
01.01.20210702.001

Thanks!谢谢!

You can use the taggerdate sort key to sort your tags, and add - in front to make it sort them in reverse order:您可以使用taggerdate排序键对标签进行排序,并在前面添加-以使其以相反的顺序对它们进行排序:

git tag --sort=-taggerdate -l

so for all your submodules, that would be所以对于你所有的子模块,那将是

git submodule foreach git tag --sort=-taggerdate -l

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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