Git has a feature called Tags, it provide an excellent, direct, and simple way to mark the code when a specific version gets released during the development life cycle. For more details refer this.

git describe command finds the most recent tag that is reachable from a commit.

Get Most Recent Tag

In below example, the last made commit in particular repository was a tagged release (v1.0.0). git describe looks into the past from the repository’s HEAD and shows the last tag.

# Find recent tag from HEAD
$ git describe
v1.0.0

On the other hand, if the environment is on a branch that is 14 commits ahead of the last tag, it will return something like this:

$ git describe
v1.0.0-14-g2414721

In the above example, the current head of the branch is based on v1.0.0. But it has a 14 commits on top of that, so git describe has appended the number of additional commits (14) and an abbreviated SHA for the current commit (2414721). SHA part of the suffix starts with g followed by the first 7-characters of the SHA (which in this example was 2414721g568193d058079d897d13c4e377f92dc6).

Find the tag from specific point

If you don’t want to manually check out a particular commit to find the previous tag from there, you can also pass a commit hash argument to find the next release tag from that moment in time.

$ git describe e85517a286067

This example search for tags after the given commit SHA.