I'm a sole developer, using GIT for version-control of embedded software written in C. The software needs to be aware of it's version, and it's currently done by including a header file with a single #define:
#define SOFTWARE_VERSION "1.021"
This header file is automatically created by pre-build Python script that tries to obtain the latest tag form GIT repository (I tag all released versions with current version string). This is the command I use to obtain last version string.
git describe --tag HEAD
The whole chain works as expected, but it doesn't seem robust (I expect it to break as repository gets more complicated/branched). Also, I think I might be missing something crucial, as there's got to be easier way to do this.
Can anyone offer improvements on workflow or implementation details? (if anyone's interested, I can post python script that parses the output of git describe)