Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Pre-push code for automatically generating GitBook static html, pushing the markdown to a master branch and the generated html to a gh-pages branch on github. Save as a pre-push hook (git 1.8 or above) for the master branch. Set the _book folder and contents to be ignored in the master branch to avoid duplication.
gitbook build /path/to/markdown --output=/path/to/markdown/_book
cd /path/to/markdown/_book
git init
git commit --allow-empty -m 'update book'
git checkout -b gh-pages
touch .nojekyll
git add .
git commit -am "update book"
git push gh-pages --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment