version control - How do I search the content of tag annotations in git? -


i release first version of first git-managed project , going tag annotated tag ("first alpha release"). later on, find out first alpha release, search contents of tag annotations "first alpha". how do so?

i know git log --grep search contents of commit messages , git show tell me contents of tag annotation, can't figure out manpages or google command search on tag annotations. have dump records tag annotations stored , search using tool? envisioning git show $(git tag)|grep "first alpha" , hoping there better way.

this use external grep seems more elegant parsing output of git show:

git tag -l -n | grep "first alpha"

and nicely output: test_1.2.3 first alpha

note -n flag, here assume annotation 1 line long. longer messages need give number after -n (lets -n99) , more complicated regarding grep flags. https://www.kernel.org/pub/software/scm/git/docs/git-tag.html

one way search multiline annotations gawk (example bash command line shown):

git tag -l -n99 | gawk -v pat='<some regex>' -- '/^\s/ {tag=$1} $0~pat { print tag }' 

/^\s/ {tag=$1} saves each tag name in turn, , $0~pat { print tag }' prints tag name when match found.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

Maven Javadoc 'Cannot find default setter' and fails -