push local master *into* gh-pages branch on github

backspaces picture backspaces · Dec 5, 2013 · Viewed 20.5k times · Source

I created a simple gh-pages branch on github and in my local repo. I used the auto page generator to create the 5 files it uses: images javascripts stylesheets index.html params.json

I pulled this to my local repo and added js-markdown-extra.js to javascripts, and edited index.html to replace the "content" section with the compiled README.md created by the markdown library.

Putting in a dummy README.md showed it to work perfectly.

I want to then simply push my local master into (not onto) the remote gh-pages branch, without modifying the 5 website files.

I haven't found a way to do this. I was told via http://oli.jp/2011/github-pages-workflow/ that this would work: git push -f origin master:gh-pages

I tried this on a test repo and it failed, resulting in a 404 (pushing the local gh-pages made for the markdown trick fixed that)

So is there a way to push master into, as a subset of, gh-pages?

Failing that, is there a simple way to merge the master into gh-pages locally without deleting the 5 website files?

I know how to "mirror" all this stuff so the 5 files would be in the repo but I'd like to avoid that clutter.

Answer

stellarhopper picture stellarhopper · Dec 6, 2013

From what I understand, you'd have to switch to your local copy of gh-pages. Merge in master, and then push gh-pages

git checkout gh-pages
git merge master
git push origin gh-pages