The structure I’m trying to setup is as follows:
-
/public_htmlrepository (“live”) what the users see, contains custom
uploaded files (e.g. user gallery images, etc, these are ignored with .gitignore) -
/stablerepository containing the latest stable source for the project (minus the ignored files) -
/public_html/devdevelopment environment, where only myself and another developer will edit files in, test online directly from this folder.
Whenever any changes are made, they are done so in the /dev repository, and changes are pushed up to /stable which I would like to create a hook to automatically update the /public_html repository with the latest stable files.
Development area
As I understand git development is usually cloned and done in a local environment, but due to licensing restrictions on the software we use, and it requiring a very specific server setup, doing local development is not an option. We therefore need to have a central development area to test changes.
My questions are as follows:
- How could I achieve the above structure?
- What needs to be a base repository and what does not (as I understand
pushto a non-base repository can be troublesome.) - Any improvements/suggestions?
/stableshould be a bare repository./public_htmlshould not be a repository at all – instead, you should usegit archiveor similar in your hook to export files from the/stablerepository into/public_html.Ideally, I’d suggest not putting your
devrepository in/public_html– it’d be better off in a separate document root of its own, that way you don’t run into potential issues from path collisions etc.