Skip to content

Getting the latest tag of a project

I wanted to get the latest tag

# one way to do it using describe
git describe --tags --abbrev=0

# another way to use straightforward git tag, and see the recent 3
git tag -l --sort=-creatordate | head -n 3

# checkout the latest tag
git checkout $(git describe --tags --abbrev=0)

adding git tag

# confirm existing tags
git tag -l 

# set tag to the latest commit and push
git tag {tag_name}
git push --tags 

# show the last commit log of the tag 
git show {tag_name}