A Software Versioning Pattern in the Git Era

June 15, 2017

Non-automated software versioning was common in the past. It was done traditionally with preprocessor, resource, and/or config numbering “bumps” (notably in C/C++ legacy projects).

In the era of ubiquitous DVCS and continuous integration, manual versioning approaches are considered harmful anti-patterns, cause stale inputs produce deliverables that carry old attributes (a testing/deploying nightmare).

From official coding repos, automated build-systems can dynamically construct authoritative version qualifiers through Git:

git describe --dirty=-_ --tags --abbrev=7 --always

Above describe command yields an identifier based on the most recent tag that predates HEAD, indicating working tree modifications, and fallbacking gracefully on empty returns (reachable refs are their own description).

SCM integrated versioning schemes are better. Release managers just tag specific commits when milestones are achieved, without leaving old stuff behind.