View Git Tags with Semver Ordering
If you’re like me, you wish all Git tags adhered to the Semantic Versioning standard. Unfortunately, Semver is just a convention, so Git tags can basically be any string of text. By default when you use the git tag command, your output will be in alphabetical order. Being a gopher, almost all the projects I work on are tagged according to Semver standards, which means the default output is fairly useless.
To print all the Git tags in a project in Semver order, simply run git tag -l | sort -V.
Alternatively, if you’re on at least version 2 of Git, you won’t even need to use the sort command, just run:
git tag -l --sort=version:refname
If you want the latest tags at the top of the output, use -version to inverse the sort:
git tag -l --sort=-version:refname
If you want your global installation of Git to default to Semver sorting, you can use the following command as of Git v2.1+:
git config --global tag.sort version:refname
Examples of Git standard output
Default alphabetical sorting
v0.0.0
v0.0.1
v0.0.12
v0.0.2
v0.1.0
v0.10.0
v1.0.0
v1.1.1
v1.11.0
v1.12.0
v10.0.0
v2.0.0
Semver sorting
v0.0.0
v0.0.1
v0.0.2
v0.0.12
v0.1.0
v0.10.0
v1.0.0
v1.1.1
v1.11.0
v1.12.0
v2.0.0
v10.0.0
If all this weird tag stuff is going over your head, you might want to check out ThePrimeagen’s full Git course here.
Related Articles
The Benefits of Gamified Learning
Jan 20, 2021 by Lane Wagner - Boot.dev co-founder and backend engineer
Why was that adjustment to college classes so hard? Sitting through hours of lectures and PowerPoints can be challenging for even the most dedicated students.
NLP is Hard Because Even Humans Don't Agree
Jan 19, 2021 by Lane Wagner - Boot.dev co-founder and backend engineer
In my full-time role at Nuvi, I’ve been lucky enough to work on a team where we’re able to push the boundaries in the natural language processing field. We built out several different “facets” that we score text on, including sentiment, emotion, vulgarity, tense, and currently, we’re working on promotion detection.
The 8 Most Popular Coding Languages of 2026
Jan 04, 2021 by Zulie Rane - Data analysis and computer science techincal author
And more importantly, how to choose the most popular coding language you should learn. How can you decide what the most popular coding language is? It’s like trying to pick the most popular ice cream flavor - everyone has a favorite. The truth is that different coders prefer different coding languages for different reasons, and just when you think you can say a single coding language reigns supreme, a new one crops up, or an older one becomes relevant for a new application.
Top Web Development Programming Languages; A Comparison
Nov 04, 2020 by Lane Wagner - Boot.dev co-founder and backend engineer
The software development industry is growing at a break-neck pace. Currently, there are close to 19 million software developers in the world, and this number is expected to double by 2030.