mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
69.21k stars 6.12k forks source link

gitGraph: support for displaying orphaned branches and unrelated histories #5366

Closed mateusza closed 4 months ago

mateusza commented 4 months ago

Proposal

In git it is possible to create a new orphaned branch, that has no parent.

git checkout --orphan=unrelated-branch

The commits made on this branch can be later merged with --allow-unrelated-histories

This is also useful when we have two independent repositories with different (ideally non-conflicting) files, that at some point we want to merge into a single one.

Example

I imagine this could be expressed in Mermaid something like:

commit
commit
commit
branch another_main orphaned: true
commit
commit
commit
checkout main
merge another_main

and should render something like this: image

Screenshots

No response

mateusza commented 4 months ago

Actually I realized this is already possible by declaring a branch before declaring a first commit on master branch.