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.75k stars 6.08k forks source link

Tag a commit separate from the line defining the commit in gitGraph #5486

Closed ketozhang closed 2 months ago

ketozhang commented 2 months ago

Proposal

In git, you can tag the HEAD (current commit).

In mermaid, tagging can only be done as part of commit. This creates an awkward syntax forcing tagging to happen on a non-release branch (e.g., dev or feature branch) when in reality most tag on the release or default branch (e.g., main)

Example

Desired syntax:

gitGraph
  commit
  commit

  branch dev
  commit
  commit id: "abcdef"

  checkout main
  merge dev
  tag "v1.0.0"  %% optionally you may add id: "abcdef"

Expected Output Similar to this, but ideally the tag should be placed on the merge node (open circle).

gitGraph
  commit
  commit

  branch dev
  commit
  commit id: "abcdef" tag: "v1.0.0"

  checkout main
  merge dev

Screenshots

No response

ketozhang commented 2 months ago

This is already accomodated using merge tags (https://github.com/mermaid-js/mermaid/pull/3361)

gitGraph
  commit
  commit

  branch dev
  commit
  commit id: "abcdef"

  checkout main
  merge dev tag: "v1.0.0"
gitGraph
  commit
  commit

  branch dev
  commit
  commit id: "abcdef"

  checkout main
  merge dev tag: "v1.0.0"

This solves my use case, but having tag as a declarative action might still be useful for other use cases. Closing... Others should request to reopen with their use cases.