If you do: git describe --long
you get: 0.3.1-15-g3b885c5
Thats the meaning of the above string:
Tag-CommitDistance-CommitId (http://git-scm.com/docs/git-describe)
How would you split the string to get the first (Tag) and last (CommitId) element?
By using String.split()
with the count parameter to manage dashes in the commitid:
$x = "0.3.1-15-g3b885c5"
$tag = $x.split("-",3)[0]
$commitid = $x.split("-",3)[-1]