I'm setting up a git repository for a website on a GoDaddy shared hosting account. Normally one would set up a git bare repo on the server that contained the live web data only, then on a push to the remote use a git post-receive hook to checkout to the live directory (thanks to @VonC for the links).
That's fine, but I've set up the repository to include work files as well. On the server I have,
/home/username/repo.git/work_folders, and /home/username/repo/web_files_and_folders
for the repository, and,
/home/username/public_html/web_files_and_folders
for the live files and folders.
The work_folders usually contain svg, png and jpg files used to generate the png and jpg files for the website. These are master files which are part of the development of the website.
The thing is I can't find an easy way to get git to checkout the web_files_and_folders only to live from any given branch. I could use the shell to wildcard select the web_files_and_folders but that doesn't solve knowing the branch name (which could change of course with each branch).
Do I need to merge to master (for instance) and then do the shell wildcard in the post-receive hook? If so, that may be a problem for other less tech savy people I'm trying to get to use the repo.
EDIT -------------------
So, to update. From a terminal shell I entered,
GIT_WORK_TREE=/home/user/public_html/dev git checkout -f dev devpath/web/*
which extracted the right files from the web folder but rather than getting,
/home/user/public_html/dev/*
I got,
/home/user/public_html/dev/devpath/web/*
Evidently I'm missing something about how to change the extract path.
EDIT 2 -------------------
Ok, more detail...
I currently have a bare repo setup on a shared server at,
/home/user/repo.git
The local repository has 2 branches, dev and master, with a file format like,
/devpath/logos/
/devpath/photos/
...
/devpath/web/ (website root files and folders)
The idea is to develop in the dev branch, push to the server and test on the dev.url of the website, and when things are good merge the dev branch into the master, push to the server and go live. Currently 2 of us are developing the website.
The post-receive hook isn't completed yet but is similar to this one. My use is pretty much the same as this link except I want the remote repository to store the other development files. These files are part of the website development and need to be shared.
What you saw in my first edit was an attempt to checkout the dev branch to the dev test site. On the server this test site is a subdomain and is accessed as a folder under the public html root in the filesystem.
It looks to me like checking out with a wildcard selector,
GIT_WORK_TREE=/home/user/public_html/dev git checkout -f dev devpath/web/*
also puts the files under that same path prior to the wildcard. I need to be able to define a new default path.
I have Git 1.7.1 on the server.