Skip to content

Instantly share code, notes, and snippets.

@AlexNisnevich
Created July 19, 2012 05:33
Show Gist options
  • Save AlexNisnevich/3140977 to your computer and use it in GitHub Desktop.
Save AlexNisnevich/3140977 to your computer and use it in GitHub Desktop.
Github Pages for generated HTML

Assuming this directory structure:

project
|-- src
|   +-- (source files)
+-- html
    +-- (generated html)

Goal: We want to simultaneously:

Set up the repo:

git init
git remote add origin <github repository location>

Add the source files to the master branch:

git add src
git commit -m "initial source commit"
git push origin master

Add the output files to an orphan gh-pages branch:

git checkout --orphan gh-pages
git rm src
git add html
git commit "initial html commit" 
git push origin gh-pages

Now to update the repo do:

git checkout master
git commit -am <commit message>
git push origin master
# generate HTML in /html
git checkout gh-pages
git commit -am "regenerating html"
git push origin gh-pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment