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
68.69k stars 6.07k forks source link

Cherry-pick shows as merge, even though there was no merge involved #5540

Open TWiStErRob opened 1 month ago

TWiStErRob commented 1 month ago

Description

When we cherry-pick a (non-merge) commit in git there's no relation between the original branch, it just copies over the commit and re-applies on current HEAD. For this reason the line between the original commit and the cherry-picked one shouldn't look like a merge.

Steps to reproduce

gitGraph
    commit
    commit
    branch feature
    commit
    commit
    checkout main
    commit
    commit id: "to-pick"
    checkout feature
    commit
    cherry-pick id: "to-pick"
    commit
    checkout main
    commit
    merge feature
    commit
    commit
gitGraph
    commit
    commit
    branch feature
    commit
    commit
    checkout main
    commit
    commit id: "to-pick"
    checkout feature
    commit
    merge main
    commit
    checkout main
    commit
    merge feature
    commit
    commit

Screenshots

image

Code Sample

```mermaid
gitGraph
    commit
    commit
    branch feature
    commit
    commit
    checkout main
    commit
    commit id: "to-pick"
    checkout feature
    commit
    cherry-pick id: "to-pick"
    commit
    checkout main
    commit
    merge feature
    commit
    commit
gitGraph
    commit
    commit
    branch feature
    commit
    commit
    checkout main
    commit
    commit id: "to-pick"
    checkout feature
    commit
    merge main
    commit
    checkout main
    commit
    merge feature
    commit
    commit


### Setup

- Mermaid version: any before 11.0.0 alpha 07
- Browser and Version: Chrome 124

### Suggested Solutions

No line, or a different line, like a straight one, or a thinner one.

### Additional Context

_No response_
Alizah143 commented 4 weeks ago

Delete the branch where Cherry-pick shows it may work

TWiStErRob commented 4 weeks ago

Can you please clarify @AminaRahim23 ? Or grab the code from sample and show what you mean?

Alizah143 commented 3 weeks ago

Screenshot 2024-06-05 125356 let me tell u whenever HEAD is showing ofc this means that u are in this branch or even id if cherry-pick is showing many it may caused by mistake if its in another branch delete the branch "git branch --delete " if this is done it may will not show but even if it does then u should "git reset --hard HEAD~1" or u can try to give any number u want to shift your HEAD just try this if it didn't worked let me know i am still here:-)