Skip to content
generate a useful version from tags, revisions and dirtiness
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This script attempts to generate a useful version number
in a git or mercurial repository using tags, revisions and
dirtiness.  For example, consider a simple untagged repo:

    $ mkdir foo
    $ cd foo
    $ git init
    $ touch README
    $ git add README
    $ git commit -m "first commit"
    $ tagver

If there aren't any tags in a repo, tagver prepends 0.0 to
the changeset number.  Now let's tag a revision for release
and try again:

    $ git tag v1.0
    $ tagver

If there's a "v" on the front of the tag, tagver assumes
it's extraneous. Now add an untagged revision:

    $ echo >> README
    $ git commit -am "second commit"
    $ tagver

and another:

    $ echo >> README
    $ git commit -am "third commit"
    $ tagver

You get the idea. What happens if we have uncommitted
changes lying around?

    $ echo >> README
    $ tagver

Note the trailing + indicating a dirty working directory.
And now let's make a new release:

    $ git commit -am "fourth commit"
    $ git tag v1.1
    $ tagver

vim: tw=60
You can’t perform that action at this time.