Reputation: 62682
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?
Upvotes: 38
Views: 12399
Reputation: 3801
The Git project repository mirror on GitHub has a todo
branch where the maintainer has some notes and apparently scripts which helps him make announcements like the status updates for the project (“What’s Cooking”).[1]
> ls
add-by CB cook dodoc.sh git-topic.perl KO people RB Release round taboo.perl WCBCC
amlook Checklist.txt Count Doit Gitweb Linus post-applypatch README.cooking RelSave RP TODO whats-cooking.txt
Announce CheckPush count-contributors.sh DoKernelOrg GRADUATED MaintNotes pre-applypatch Reintegrate RelSign SE UWC WI
AT check-topic-merges cycle-run Dothem info Make ProjectContact RelBuild RelStat SR V worklog
candidates compare-cooking.perl docbuild-8.sh genMaintNotes.perl jc.png ML pushall RelClean RelUpload Summary WC
The last message that was sent out can be viewed in whats-cooking.txt
.
So this isn’t a “separate a branch for docs” (that stuff is on the main branch) but rather a separate branch for managing announcements. And perhaps other stuff.
Here is the first commit on this branch, which of course is a root commit (no parents):
commit 1bd90415deccc4562e0fb4d0f8e58140aa687ac1
Author: Junio C Hamano <[email protected]>
Date: Fri Aug 26 00:32:15 2005 -0700
Keep track of to-do document.
This is written in a form of to-do list for me, so if I say
"accept patch", it means I do not currently plan to do that
myself. People interested in seeing it materialize please take
a hint.
Signed-off-by: Junio C Hamano <[email protected]>
† 1: As of commit acb9ef215eb2 (What's cooking (2023/03 #01), 2023-03-01)
Upvotes: 0
Reputation: 906
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.
Upvotes: 15
Reputation: 8283
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.
Upvotes: 8