I understand this is an old question, but I was just trying to do the same.
None of the related answers in the comments are a great solution to this problem. We might want to include, for example, a version of git in the generated documentation without having to deal with git filters, etc. In our working sources.
Luckily. Doxygen supports the use of environment variables in your Doxyfile and provides various settings that you can use to place information in your generated content. The PROJECT_NUMBER parameter is intended to include version control information in your documentation.
If we have this in our Doxyfile :
PROJECT_NUMBER = $(PROJECT_NUMBER)
You can run doxygen as follows to include git revision in your generated documents:
PROJECT_NUMBER=$(git rev-parse --short HEAD) doxygen
You are not limited to commit identifier only. For instance:
PROJECT_NUMBER=$(git log -1 --format "%h (%cd)") doxygen
This makes the title in my generated HTML look like:
<div id="projectname">MyProject  <span id="projectnumber">9dd847b (Fri Feb 1 15:36:13 2019 -0500)</span> </div>
source share