The answer to a question here states:
Most version control systems have a way to automatically inject the revision number on check-in for instance.
How do I do this with Git? Or have I missed the point (not what they meant by VCS)?
The answer to a question here states:
Most version control systems have a way to automatically inject the revision number on check-in for instance.
How do I do this with Git? Or have I missed the point (not what they meant by VCS)?
That definitely is what they meant by VCS. However, git doesn't have revision numbers, and you can't predict the commit hash before making the commit, which is definitely too late to inject anything inside.
What you can do is inject current commit hash into config files in the deployment flow. E.g. in the script pushing files to the server say git rev-parse --short HEAD >revision
and then use this file's content. Alternatively, if you have got repo in the server, run git rev-parse --short HEAD
on startup.