Skip to content

Instantly share code, notes, and snippets.

@michaellihs michaellihs/gittags.groovy
Last active Apr 12, 2017

Embed
What would you like to do?
Groovy script that returns an array of Git tags with versions
def gitTags = ("git tag").execute()
def tags = gitTags.text.readLines()
.collect { it.split() }
.unique()
.findAll { it =~ /\d+\.\d+\.\d+/ }
tags.reverse(true)
println tags
/*
for
$ git tag
1.0.0
1.0.1
2.0.1
2.1.1
2.1.2
test
this will return
[[2.1.2], [2.1.1], [2.0.1], [1.0.1], [1.0.0]]
*/
@michaellihs

This comment has been minimized.

Copy link
Owner Author

michaellihs commented Apr 12, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.