I have a git repository (at github.com) with two branches: master and gh-pages. I would like to have the gh-pages branch in a subdirectory, so that I don\'t need to switch branc
You may be looking for the subtree merging option.
It will let you checkout an unrelated branch into a subdirectory of another and then merge back and forth between them. You would still have to checkout gh-pages and merge in changes from the main repo before pushes would go live on GitHub, however.
You could also check gh-pages out as a submodule of your master branch if that suits you better.