mandy8055
mandy8055

Reputation: 6715

Using Orphan branches to host a project on gh-pages

My use-case:

I am working on a hobby project which contains multiple mini-projects. Instead of creating a separate repo for every single mini-project, I thought to create a single repo with multiple orphan branches, so as to keep all the mini-projects with un-related histories and belong to single repo (repo is based on a language or a framework).

Question:

In addition to the above use-case, I also want to host each of my orphan branches to gh-pages separately. I know how to manage a repo with multiple orphan branches. But I wanted to know if it is possible to host multiple orphan branches onto gh-pages from a single repo?

My Inputs:

  1. I am aware of how to create and manage multiple orphan branches in a single repo.
  2. I want to completely isolate histories of each of my mini-projects that's why I chose to use orphan-branches.
  3. I am aware of how to host static websites and docs on gh-pages.

Any suggestions would really be helpful.

Upvotes: 1

Views: 271

Answers (1)

VonC
VonC

Reputation: 1326852

Considering a GitHub Pages configuration source is for one repository, you would still need one repo per project.

But that does not mean you cannot maintain them all from one "parent" repository.

You could add each gh-pages branch of each of those project/pages repositories as a submodule of one parent repo:

cd path/to/parent
git submodule add -b gh-pages /url/project1
git submodule add -b gh-pages /url/project2
...

In each projectx folder, you can:

  • fetch and switch to the gh-pages branch
  • work, add and commit, and push

Once you are done, go back to the parent main folder, add, commit and push, to record all the submodules new tree.

The idea remains: in one cloned repository, you can work on all your gh-pages branches projects.

Upvotes: 1

Related Questions