Reputation: 10911
I've just been introduced to orphan nodes in Git and I was wondering what sort of potential problems I could expect with using them?
Upvotes: 6
Views: 2806
Reputation: 45779
If you at some point need to merge across the branches, you'll have to use the --allow-unrelated-histories
option; but it's literally as easy as adding that option to the merge
command, and if you omit it git will tell you exactly what you'd need to do.
So if that counts as an issue, there's that. Otherwise, whether you have independent roots in your repo doesn't really affect much of anything functionally.
Upvotes: 5
Reputation: 312263
The subject of this question ("...multiple root nodes...") makes me suspect that you and @raina77ow are actually using "orphan" to refer to two different things. The thread to which the comments links discusses what are normally called dangling commits, while an "orphan" branch typically means a branch that doesn't share history with other branches in your repository. You can create one like:
git checkout --orphan newbranch
There's nothing inherently wrong with orphan branches. In fact, tools like GitHub Pages rely on orphan branches to manage content.
Upvotes: 9
Reputation: 10695
It's a common situation as an example when you try to merge the histories of 2 git repositories into one. There is no big issue of having orphaned branches, other than confusion of users.
Upvotes: 2