How to list all tags that contain a commit?

This question is similar to How to list all tags pointing to a specific commit in git, but with one difference: I wish to search for all tags that contain a specific commit within the tree of each tag, not specifically the files marked in the tag itself (in this case, only the Makefile change has been tagged).

  • Got a confusing git error message
  • Handle multiple pre-commit hooks
  • Git pull on local does not remove already deleted files
  • How can I push a new branch?
  • Key with fingerprint not authorized in Heroku
  • How to get the list of git commands and the version they are introduced?
  • Retroactive svn import into git
  • What is a patch in git version control?
  • Django deployment using git, including production-relevant files
  • Troubles with shebang in gitolite hooks
  • Git: “Cannot 'squash' without a previous commit” error while rebase
  • Is there a simple command to convert a branch to a tag?
  • 3 Solutions collect form web for “How to list all tags that contain a commit?”

    git tag --contains <commit>

    should be sufficient, right?

    Note that you need git 2.0.x (Q3 2014) in order to list all tags for a certain commit if you have a large repo

    See commit cbc60b6 by Jean-Jacques Lafay (lanfeust69):

    git tag --contains: avoid stack overflow

    In large repos, the recursion implementation of contains(commit, commit_list) may result in a stack overflow. Replace the recursion with a loop to fix it.

    This problem is more apparent on Windows than on Linux, where the stack is more limited by default.

    See also this thread on the msysGit list.

    git tag --contains <sha1_hash> 

    should work

    Git Baby is a git and github fan, let's start git clone.