Git does not support these placeholders and probably never will.
Instead, automatically create a source file containing the output of the git describe command and including it at compile time of your application. Or you can create some kind of configuration file (JSON or whatever).
To generate a C ++ header with version information, use a shell script like this (you can add these commands directly to your file):
( echo '/* Generated file, do not edit. */' echo '#define APP_VERSION "'`git describe`'"' echo '#define APP_VERSION_DATE "'`git log -n 1 --format=%ai`'"' ) > version.h
To do this for scripting languages, you can use post-commit and other interceptors.
source share