views:

33

answers:

3

Hi!

I need Git command to get/find last tag starting with 'v' to get last versioning commit (I am using tags with v letter at the beginning to tag next application version (example: v0.9.1beta).

Is there any way to do it?

+1  A: 
git tag -l -n v*
simplemotives
It lists all tag matching criteria. I need only last one, so git describe --match v*. Anyway thanks for hints as tags and describe command are linked together on the git manual pages.
Lukasz
+4  A: 

I'm using the following command for this:

git describe --match "v[0-9]*" --abbrev=4 HEAD

It will also modify the version if you did something with the source tree since your last versioned tag.

KARASZI István
A: 

git describe --match v*

Lukasz
this will include all the tags starts with `v`, so it'll list all the words not just versions
KARASZI István
Yep... that is true. Anyway I flagged your regex as a solving my question. Should I delete this answer?
Lukasz
thanks for the accept! no, I think no need to delete this answer.
KARASZI István