Add git tag and version number to an Arduino sketch.

The problem:

Version control and tracking is hard.
For sure in the Arduino IDE, which invites to rapid prototyping and has no built-in version tracking or version control mechanism.

A possible solution:

To make it somewhat more practical and less error prone I made some scripts to assist this process.
It works if you already use or start using git for your version control.

Using these scripts is as easy as adding them to your sketch folder and adding

#include "gitTagVersion.h"
...
Serial.println( sketchVersion );

to your Arduino sketch.
That is all that is needed.

The output in the example above will be something like v1.0.0-3-gab3fb04.
That breaks down to tag v1.0.0, 3 commits since that tag, at commit ab3fb04.

How to install and use?

Continue reading