Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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:

git submodule foreach git tag -l

So as an example. I have the following submodule (components), AccltrInterLckDet listed along with all of its tags:

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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!

>Solution :

You can use the taggerdate sort key to sort your tags, and add - in front to make it sort them in reverse order:

git tag --sort=-taggerdate -l

so for all your submodules, that would be

git submodule foreach git tag --sort=-taggerdate -l
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading