Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitGraph support parallel commit #5114

Closed
ppggff opened this issue Dec 5, 2023 · 2 comments · Fixed by #5161
Closed

gitGraph support parallel commit #5114

ppggff opened this issue Dec 5, 2023 · 2 comments · Fixed by #5161

Comments

@ppggff
Copy link

ppggff commented Dec 5, 2023

Description

Consider following diagram:

gitGraph
    commit
    commit
    branch develop
    checkout develop
    commit
    commit
    checkout main
    commit
    commit
gitGraph
    commit
    commit
    branch develop
    checkout develop
    commit
    commit
    checkout main
    commit
    commit
Loading

The last two commits in the main branch are committed after the two in the develop branch.
Is there a way to show them as parallel commits?

Such as:

Screenshot 2023-12-05 at 14 35 06

May be add a option to the checkout command?

Steps to reproduce

as above

Screenshots

No response

Code Sample

No response

Setup

  • Mermaid version:
  • Browser and Version: [Chrome, Edge, Firefox]

Suggested Solutions

No response

Additional Context

No response

@ppggff ppggff added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Dec 5, 2023
@sidharthv96
Copy link
Member

I think that is intentional, as the commit order shows the temporal data. Most of the auto-generated graphs follow the same design. It is possible to draw it like this if we switch branches.

gitGraph
    commit
    commit
    branch develop
    checkout develop
    commit
    checkout main
    commit
    checkout develop
    commit
    checkout main
    commit
Loading

Adding a parameter to checkout is one option, but if someone needs the entire graph to have parallel commits, it might become cumbersome. We could also introduce a config option config.git.parallelCommits to apply the style to the complete graph.

The config option should be the first step, before we make any changes to the grammar.

@sidharthv96 sidharthv96 added Type: Enhancement New feature or request Contributor needed Status: Approved Is ready to be worked on Area: Development Graph: Git Internals: Renderer and removed Type: Bug / Error Something isn't working or is incorrect Status: Triage Needs to be verified, categorized, etc labels Dec 6, 2023
@ppggff
Copy link
Author

ppggff commented Dec 6, 2023

Thanks, my original user case for this parallel commit is to:

  • describe the development of a series of events, as a time line
  • there are multiple timelines because events may change under different situation

Since is a join of multiple timelines, I hope the event points in different timelines to be independent.

Maybe we could control the order between commit in different branch, such as: commit id "a" before/after "b".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants