Branching for Github Pages

Written Aug. 16, 2013 by Matt Jordan

GitHub repos that also have a Pages branch are getting more commonplace, and maintaining these branches can a pain in the ass.

This is a simple method of adding multiple branches to one working directory. While I am only discussing adding master and gh-pages branches, the idea can be used for any branch.

Intended directory structure

How to:

First, create a main directory, then add the master branch locally.

repo-name should be the name of your repository.

Now we add the gh-pages branch locally.

Please note: running git clone git@github.com:username/repo.git XXX will create a directory named XXX. Alternatively, you can mkdir a directory, cd into it and use a period . to use the current dir.