We have a repo in a strict development environment and private webserver residing in /var/www/dev/repo. We want any branches that are created to automatically be created and added to /var/www/branches/feature-coolfeature and auto-based on the master-branch (or the "base on branch"). This way we can very easily load, codewise, the new branch in to our /var/www/dev/repo and demo our new branch-features for clients and product owners.
Think of a "branch-switcher" in our platform that will switch between development branches. In addition, we want to be able to do commits to /var/www/branches/feature-coolfeature, both directly on the server in the given folder but also through Github Desktop for example.
We understand we may be very far out on this one and appreciate any pointers on where we can go with this flow, or even try a totally different one. So far we've managed to through Github webhooks create the folder structure and copy everything from the original repository, except it doesn't understand it's actually a branch (thinks it's the master-branch) and we're just seeing several signs that we're approaching this problem from a very, very bad angle. Both github-related but also permission-wise. We're developers trying to learn DevOps.
Would appreciate any and all advice.