With git describe
you can get the number of commits since the last tag. If you only had the tag and the number of commits what is the best way to show the commit t
What you're asking for is impossible in the general case. The number of commits alone can't tell you anything if there are any merges in your history.
For example, given the following repo structure:
a - b - c - d - h
\ /
e - f - g
With a tag put on a
, the outputs of git describe d
and git describe g
are identical save for the SHA1:
> git describe d
tag-3-ge8dca33
> git describe g
tag-3-g4fecc2e
That said, if you don't have a bunch of parallel branches going on at once, then you may be able to resolve a given commit number back to a single commit, but if you have even a single active side branch at the time of your tag then this may not work.
If you need reliable release numbers, you should stick to explicit tags.