We can get the last git tag, which starts by a word(e.g TEST) as follow:
git describe --tag --dirty --match 'TEST*'
I am wondering how can I get the last tag, which starts by word1 or word2 (e.g. TEST OR RUN)? I've tried to use regex or following but it does not work:
git describe --tag --dirty --match 'TEST*|RUN*'
SOLUTION: We can get number of commits to HEAD and compare those numbers, the one which has less commits is the more recently. You can find its script in the answer, which I have added.
The pattern is matched using fnmatch(), which uses shell wildcard patterns, not regular expressions.
As shell wildcards don't support alternation you can't do this without changing the implementation of describe.
Source: git describe source :P
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