Because tags serve as such great "anchors" in the codebase,
git has a command to describe where you are relative to the closest "anchor" (aka tag).
And that command is called
Git describe can help you get your bearings after you have moved many commits backwards or forwards in history; this can happen after you've completed a git bisect (a debugging search) or when sitting down at a coworkers computer who just got back from vacation.
Git describe takes the form of:
git describe "ref"
Where "ref" is anything git can resolve into a commit. If you don't specify a ref, git just uses where you're checked out right now (HEAD).
The output of the command looks like:
Where "tag" is the closest ancestor tag in history, "numCommits" is how many commits away that tag is, and "hash" is the hash of the commit being described.
Let's look at a quick example. For this tree below:
git v2 C3
git describe master would output:
git describe side would output: