I would like my micro-services application to respond with the code version of it at runtime. To get that going I would embed a version number in an untracked file, and each micro-service would serve that number when responding to a certain api call.
The version number would be written to the untracked file by a commit script.
Would using git log --oneline | wc -l be a reliable way of auto-generating an incremental version number for every git commit? (other reliable alternatives very welcome...)
My requirement is that each commit would generate a version number higher than all previous ones.. the other requirement is that this is not dependant on any CI server, but rather each developer commit would take care of this (so that this works even before there is a CI server).
What would be the git tinkerings commonly performed by developers, that would undermine this scheme?