Automatically add version to sources (not only Python) - GIT hooks
Problem
You want to know version of the application instance.
For mature development flow (development - testing - demo - production)
there is always version.
But for the price - somebody has to set it (for example as git tag
).
But we need versions for our internal process like deployment to development server.
For this purposes we can use git hooks
.
This is scripts that run locally by git
for different events.
For example before commit.
Script below saves date and time to some file.
Name this file as git_hook_pre_commit.sh
.
And this name as git_hook_post_commit.sh
, it adds
this file to the commit.
As it’s inside your source code you can use it like this:
For security reasons you have to install git hooks
by yourself on each machine you use for development.
Script below installs our scripts as pre-comit and post-commit git hooks
.