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
Generally with version control it's not a good idea to combine multiple projects into a single repository. For instance, what if someone would like to fork your repository, but not host their copy at GitHub? Then the gh-pages
directory would be completely useless to them. Even if they did host theirs at GitHub, the gh-pages
directory could very well still be irrelevant to them.
I realize that the GitHub way of doing this goes against this advice, somewhat (after all, even though they are on different branches, they're still in the same repo). However, the branches in this case are completely unrelated (they don't share any history) so from a practical perspective, it's as if they were in separate repositories. If someone clones your repo and doesn't want the gh-pages
branch, they can delete it and it will have zero effect on master
.