Reputation: 1281
I would like to checkout the highest version number and checkout that branch.
Currently I am doing:
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
But when the latest tag was 3.7.1 I will checkout this instead of another version which have the version number 4.0.1.
How can I make sure to checkout the highest version number?
Upvotes: 6
Views: 3044
Reputation: 16012
You are able to sort tags by semantic version names:
$ git checkout $(git tag -l --sort -version:refname | head -n 1)
Upvotes: 17