From a93f37a3fc0c515ac25661f0554e513d5081aa24 Mon Sep 17 00:00:00 2001 From: ashishj Date: Tue, 30 Aug 2022 19:25:22 +0200 Subject: [PATCH] #3238 Updated documentation --- .../integration/rendering/gitGraph.spec.js | 4 +-- docs/gitgraph.md | 35 ++++++++++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/cypress/integration/rendering/gitGraph.spec.js b/cypress/integration/rendering/gitGraph.spec.js index 44035c9c2..80981c31c 100644 --- a/cypress/integration/rendering/gitGraph.spec.js +++ b/cypress/integration/rendering/gitGraph.spec.js @@ -253,7 +253,7 @@ describe('Git Graph diagram', () => { {} ); }); - it('12: should render a simple gitgraph with three branches,custom merge commit id,tag,type', () => { + it('13: should render a simple gitgraph with three branches,custom merge commit id,tag,type', () => { imgSnapshotTest( `gitGraph commit id: "1" @@ -272,7 +272,7 @@ describe('Git Graph diagram', () => { checkout nice_feature commit id: "7" checkout main - merge nice_feature id: "customID" tag: "customTag" type: "REVERSE" + merge nice_feature id: "customID" tag: "customTag" type: REVERSE checkout very_nice_feature commit id: "8" checkout main diff --git a/docs/gitgraph.md b/docs/gitgraph.md index 53e802101..191bc513b 100644 --- a/docs/gitgraph.md +++ b/docs/gitgraph.md @@ -182,7 +182,40 @@ After this we made use of the `checkout` keyword to set the current branch as `m After this we merge the `develop` branch onto the current branch `main`, resulting in a merge commit. Since the current branch at this point is still `main`, the last two commits are registered against that. -Additionally, you may add a tag to the merge commit, or override the default id: `merge branch id:"1234" tag:"v1.0.0"` +You can also decorate your merge with similar attributes as you did for the commit using: +- `id`--> To override the default ID with custom ID +- `tag`--> To add a custom tag to your merge commit +- `type`--> To override the default shape of merge commit. Here you can use other commit type mentioned earlier. + +And you can choose to use none, some or all of these attributes together. +For example: `merge develop id: "my_custom_id" tag: "my_custom_tag" type: REVERSE` + +Let us see how this works with the help of the following diagram: + +```mermaid-example + gitGraph + commit id: "1" + commit id: "2" + branch nice_feature + checkout nice_feature + commit id: "3" + checkout main + commit id: "4" + checkout nice_feature + branch very_nice_feature + checkout very_nice_feature + commit id: "5" + checkout main + commit id: "6" + checkout nice_feature + commit id: "7" + checkout main + merge nice_feature id: "customID" tag: "customTag" type: REVERSE + checkout very_nice_feature + commit id: "8" + checkout main + commit id: "9" +``` ### Cherry Pick commit from another branch Similar to how 'git' allows you to cherry-pick a commit from **another branch** onto the **current** branch, Mermaid also supports this functionality. You can also cherry-pick a commit from another branch using the `cherry-pick` keyword.