aaronrussell aaronrussell - 3 months ago 13
Git Question

How to create Github pages from a project's documentation?

I have a project on Github that has a directory containing some automatically generated HTML documentation. I would like to use that documentation within Github's project pages facility.

So, I've read the instructions on how to create the project's gh-pages root branch. This effectively creates an empty branch.

What I'd like help with is mirroring the html files in the

/docs
path from the
master
branch, so they are in the root of the
gh-pages
branch. What is the best way of approaching this?

Answer

Answering my own question here... have achieved what I wanted with Git submodules.

I basically copied what's detailed in this sake task, but in summary:

  • Moved the docs path into a temp folder. Commit changes.
  • Created a clean gh-pages branch as per the usual instructions
  • Moved everything from the temp folder into the new gh-pages branch. Commit changes.
  • Back in the master branch, add the remote gh-pages as a submodule in the docs folder.
  • Commit changes. Voila!