Forrest logo
back to the git tool

git-tag:tldr:d44a9

git-tag: List all tags whose ancestors include a given commit.
$ git tag --contains ${commit}
try on your machine

The command "git tag --contains ${commit}" is used to list or display any Git tags that contain a specific commit.

Here is a breakdown of each part of the command:

  • "git tag": This is the basic command to interact with Git tags. It allows you to manage and view tags within your Git repository.
  • "--contains": This option specifies the condition to display tags based on a commit.
  • "${commit}": This is a placeholder that should be replaced with the commit hash or tag name you want to check.

By executing this command, Git will search for all tags in your repository and check if the specified commit is part of any of those tags. If there is a match, it will display the tag(s) that include the commit in the output.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the git tool