Create a disconnected git branch
A disconnected git branch has a parent that is not related to your project history. It's useful for starting a new branch for GitHub Pages. This tip removes files so start off in a brand new clone of your repo:
git clone --no-checkout https://github.com/destructuring/cue
Use a local repo to save time and space since it avoids the network and uses hardlinks:
git clone --no-checkout /path/to/cue
Create a new disconnected branch:
git checkout --orphan gh-pages
At this point there are no commits but lots of files from whatever branch you were on. Have git remove those files:
git rm -rf .
Submodules and files not tracked in git won't be deleted but we'll get to that later.
Make your first commit, usually an empty README.md. Once you have one commit, git can clean the files leftover from "git rm" with "git clean". Don't run this in the wrong directory or you may end up deleting / or $HOME.
git clean -fdx
Then push the new branch to origin:
git push origin gh-pages