3

How To Get The Latest Tag On Git

 2 years ago
source link: https://rafaelnexus.com/tips/how-to-get-the-latest-tag-on-git/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How To Get The Latest Tag On Git

at Mon Feb 18, 2019 in

tips

git-main.png

Tags on Git are usually used to mark versions, specific points in the project’s timeline that represents a release.

Very often we need to check which was the latest or biggest version number tagged, using only git tag command it can become really tricky after a while because it returns all the tags created in numerical order.

But you can easily retrieve the latest added tag by issuing.

git describe --tags

But if for some weird reason someone created a tag out of order you will not get the biggest version number on the tag list.

In this case, we can achieve this using the external command sort and tail.

git tag | sort --version-sort | tail -n1

facebook sharing button Share
twitter sharing button Tweet
linkedin sharing button

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK