1

Branches in git repos or similar are practically always derived from the same code base; after all, they're usually merged back in to master later.

But, if you wanted your open source project on GitHub to have a website, you could use GitHub Pages, which lets you publish a site in a repo on a branch named gh-pages. Unless said open source project is a frontend web app, gh-pages will by necessity not be based on master.

Are there any other scenarios where you would want to maintain different branches in the same repo that have completely different code bases or histories?

  • 3
    It's one of the few things where I think GitHub chose a bad solution. A separate pages repo would be so much cleaner. Why should I bloat a nice small code repo with images and html? It makes no sense. – Wilbert Oct 26 '15 at 14:19
  • I just use headless/orphan branches, which don't share a parent with master: git checkout --orphan gh-pages. Displays fine on github too. – MaulingMonkey Nov 9 '15 at 17:37
  • @MaulingMonkey That's a thing? – JesseTG Nov 9 '15 at 20:57
  • Also, the lack of answers, while probably a bad thing normally, speaks volumes here. Here, a lack of answers just means "no". – JesseTG Nov 9 '15 at 20:58