Skip to content

Get the Latest Tag from a Repository URL

List version-sorted remote tags that match a dotted triple and print the highest name, skipping peeled annotated-tag objects.

Language: Git

Added on: 7th October 2026

git -c versionsort.suffix=- ls-remote --tags --sort=v:refname <REPO URL> '*.*.*' | awk -F/ '/refs\/tags\// && !/\^\{\}$/ {print $3}' | tail -n1

Caveats

Replace with the remote. Talks to the remote. Only matches tags of the form ..*.