In order to achieve this I was using something like:
This works but a drawback is that I either see the tag or the latest commit.
So a coworker pointed me to this:
git describe --tags --always
which I didn't know and it's just great. It returns a string with this format:
TAG is the most recent tag.
N is the number of commits from the TAG.
'g' is just a formatting convention.
SHA is the latest commit (HEAD).
If the latest commit is also pointed by the tag, then it just returns TAG.
'git describe' is explained here.
Post a Comment