Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to search tag by name in GIT?

Tags:

git

search

tags

Is there any possibility to search tag by name? In the project there is many tags and some of them have the same (specific) word in their names. Using git tag is presenting all available tags, but I want to get tag list of these with a specific word in name.

like image 649
faramka Avatar asked Mar 05 '18 13:03

faramka


People also ask

How do I search for a specific tag in git?

In order to find the latest Git tag available on your repository, you have to use the “git describe” command with the “–tags” option. This way, you will be presented with the tag that is associated with the latest commit of your current checked out branch.

How do I switch to a specific tag in git?

To switch to a commit-like object, including single commits and tags, use git switch --detach <commitish> , where <commitish> is the tag name or commit number.

What is tag name in git?

Tags are ref's that point to specific points in Git history. Tagging is generally used to capture a point in history that is used for a marked version release (i.e. v1. 0.1). A tag is like a branch that doesn't change. Unlike branches, tags, after being created, have no further history of commits.


2 Answers

git tag -l accepts an optional parameter, which is a (fnmatch-like) pattern. So you can use (for example) git tag -l '*word*' if you want to list tags with “word” in their name.

like image 102
Arkanosis Avatar answered Oct 07 '22 22:10

Arkanosis


I think you need to use egrep with appropriate regex for you. At first glance this one is good:

git tag | egrep *word*
like image 35
Joik Avatar answered Oct 07 '22 21:10

Joik