Dev Notes

Various Cheat Sheets and Resources by David Egan/Carawebs.

Jekyll Push to gh-pages Branch

David Egan

Make a sub-directory that contains a Jekyll site available at the gh-pages branch of a GitHub repo.

The site will then be available at

To begin with, set up an empty Repo. Don’t add a when prompted.

Initialise git in the local project directory, and connect to the new repo.

cd project-directory
git init
git remote add origin

Initial Subtree Commit

The local Jekyll site is built to the _site directory.

We need to tell git about the sub-directory and make an initial commit:

git add _site && git commit -m "Initial _site subtree commit"

Push to gh-pages

Send _site to the gh-pages branch on GitHub

git subtree push --prefix _site origin gh-pages

Push Ongoing Changes

Push all changes to the master branch:

git add -A

git commit -m "commit message"

Push changes to the gh-pages branch:

git subtree push --prefix _site origin gh-pages

comments powered by Disqus