Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list all tags that contain a commit?

Tags:

git

People also ask

How do you check if a commit has a tag?

Check the documentation for git describe . It finds the nearest tag to a given commit (that is a tag which points to an ancestor of the commit) and describes that commit in terms of the tag. In newer versions, git describe --tags --abbrev=0 REV will be useful when you don't want the junk on the tag.

How do I see contents of commit?

Viewing a list of the latest commits. If you want to see what's happened recently in your project, you can use git log . This command will output a list of the latest commits in chronological order, with the latest commit first.

How do I list all tags?

In order to list Git tags, you have to use the “git tag” command with no arguments. You can also execute “git tag” with the “-n” option in order to have an extensive description of your tag list. Optionally, you can choose to specify a tag pattern with the “-l” option followed by the tag pattern.

How do I see git tags?

Listing the available tags in Git is straightforward. Just type git tag (with optional -l or --list ). You can also search for tags that match a particular pattern. The command finds the most recent tag that is reachable from a commit.


git tag --contains <commit>

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.