How to find the first tag that contains a git commit

git

I have the SHA ID of a commit that I am interested in and would like to know how to find the first tag that contains it.

Best Answer

As previously stated, this can be done with git describe. In your particular case, however, you may find it more convenient to run git name-rev --tags --name-only <SHA>, which outputs exactly what you want. See git-name-rev(1).

Related Question