I'm developing a jQuery plugin that's being hosting on GitHub. It has a demo included of which I'm manually copying and pushing to the branch gh-pages
, what I'd like to do is have it so when I push a change to master
it is automatically pushed to gh-pages
, or at least a setup where they are mirrored.
I've already seen this question but not sure if it really answers my question with regard to these requirements:
- I use Tower, I don't mind using the terminal (Mac) to make changes to config, so long as the solution works with this GUI.
- I only want this 'mirroring' on certain repos, not on all of them on my machine.
Cheers
UPDATE: GitHub now allows pages to be published from any branch and directory you want.
It was much easier for me to use the
gh-pages
branch as master. There's nothing magical about "master"; it's just another branch name. There is something magical about gh-pages, because that's where GitHub is looking for index.html to serve your page.Read more in my other answer on this topic.
Using
gh-pages
as master is also easier than subtrees, which are easier than mirroring. You could usegit subtree
as described here or here: if you have a directory which contains your demo, you can push that directory to thegh-branch
with one command. Let's say you name the directorygh-pages
to make things clear. Then after you've committed and pushed your changes tomaster
, run this to update gh-pages:The problem is if your files in
gh-pages
refer to files in other directories outside it. Symlinks don't work, so you'll have to copy files in the directory that serves as gh-pages.If you use
gh-pages
as master, this problem won't occur.