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

bottom-to-top oriented gitgraphs to mimic git logs #5239

Closed
arkadianriver opened this issue Jan 25, 2024 · 2 comments · Fixed by #5259
Closed

bottom-to-top oriented gitgraphs to mimic git logs #5239

arkadianriver opened this issue Jan 25, 2024 · 2 comments · Fixed by #5259

Comments

@arkadianriver
Copy link

Proposal

First, I love how beautiful Mermaid's git graphs are compared to others!

This proposal is to add BT orientation, because that's how we commonly see git graphs in the wild when viewing git log histories (with commits listed in reverse chronological order).

Use Cases

This is particularly useful when working with folks and documenting situations that they might see in their git histories. It would be helpful to keep the orientation the same.

Screenshots

Two such examples of this orientation are the git histories provided by the VS Code extensions Git Graph and GitLens:

  • GitGraph:
    20240125_111918-Git Graph - hqtodo - Visual Studio Code

  • GitLens:
    20240125_112446-hqtodo - Visual Studio Code

Syntax

BT to go along with the existing LR and TB

Implementation

This is a proposal which I'd love to see built into mermaid by the wonderful community.

@JingyuMarcelLee
Copy link
Contributor

JingyuMarcelLee commented Feb 3, 2024

For now, I simply flipped the TB orientation. The syntax is exactly the same with the TB option except you add BT after gitgraph in the markdown. Below are the same gitgraph, but with different orientations.

  • TB
    ---
    title: Three branches and a cherry-pick from each (top-to-bottom)
    ---
    gitGraph TB:
    commit id: "ZERO"
    branch develop
    commit id:"A"
    checkout main
    commit id:"ONE"
    checkout develop
    commit id:"B"
    branch featureA
    commit id:"FIX"
    commit id: "FIX-2"
    checkout main
    commit id:"TWO"
    cherry-pick id:"A"
    commit id:"THREE"
    cherry-pick id:"FIX"
    checkout develop
    commit id:"C"
    merge featureA

image

  • BT
    ---
    title: Three branches and a cherry-pick from each (bottom-to-top)
    ---
    gitGraph BT:
    commit id: "ZERO"
    branch develop
    commit id:"A"
    checkout main
    commit id:"ONE"
    checkout develop
    commit id:"B"
    branch featureA
    commit id:"FIX"
    commit id: "FIX-2"
    checkout main
    commit id:"TWO"
    cherry-pick id:"A"
    commit id:"THREE"
    cherry-pick id:"FIX"
    checkout develop
    commit id:"C"
    merge featureA

image

Please let me know if there should be any additional changes.

@arkadianriver
Copy link
Author

Nice, thanks for working on this Jingyu. 😎

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.

3 participants