38

Git can host multiple DAGs in the same repo with git checkout --orphan command. A frequently cited use case this feature of git is to keep separate a branch for docs or the GitHub gh-pages orphaned branch for creating a static website.

Are there other reasons to use orphaned branches in git?

hichris123
  • 9,955
  • 15
  • 53
  • 68
ams
  • 56,310
  • 64
  • 182
  • 269

2 Answers2

14

Another possible use of this is for combining multiple repositories into one. A few examples:

In these cases you will have two separate DAGs in the same repository before they are merged into a single unified tree. Thus this is not as much a long-term use, but an action that will temporarily pass through the state of having separate DAGs in the same repository.

Peter Olson
  • 751
  • 1
  • 8
  • 17
8

Another use case by the git online documentation:

This can be useful when you want to publish the tree from a commit without exposing its full history. You might want to do this to publish an open source branch of a project whose current tree is "clean", but whose full history contains proprietary or otherwise encumbered bits of code.

toraritte
  • 5,163
  • 3
  • 36
  • 58