I have a lot of minor projects that follows the semantic versioning standard. Coupled with git flow this makes my life a little easier. Life can always get easier though, so here is a very rudimentary script for retrieving next version from the latest tag in git:
#!/usr/bin/env ruby inc = ARGV[0] version = `git describe --tag $(git rev-list --tags --max-count=1)` v = Hash[[:major, :minor, :patch].zip(version.split('.'))] case inc when 'major' v[:major] = v[:major].to_i + 1 v[:minor] = 0 v[:patch] = 0 when 'minor' v[:minor] = v[:minor].to_i + 1 v[:patch] = 0 when 'patch' v[:patch] = v[:patch].to_i + 1 end puts v.values.join('.') |
put it somewhere in you path, and call it something like nextver, and the next time you are doing a release, just run
git flow release start $(nextver minor)
No need for checking what the last release was, it is automagically handled:)