I'm using git post-receive hook to deploy versions of the web application from three branches (master, staging, and stable) on three servers (development, testing and production). The pairing between branches and servers is currently hard-coded in the script. However I'd like to remove this restriction and make this hook possible to manage unlimited quantity of branches. It can be done in the following way:
- move all per-branch config options to some separate files, for example
.git/???/<branch_name>
- the main script will check if such file is available for every branch, source it and then deploy on the remote server using configuration parameters from that file.
However I don't know where exactly in .git
directory can I place such files. Or maybe there is a better solution?