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.
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.
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.
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 overflowIn 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With