Skip to content

Commit

Permalink
Amend docs to document gitgraph parallel commits
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasCwy committed Feb 27, 2024
1 parent 70c8a3d commit ddf85c3
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
57 changes: 57 additions & 0 deletions docs/syntax/gitgraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ In Mermaid, you have the option to configure the gitgraph diagram. You can confi
- `showCommitLabel` : Boolean, default is `true`. If set to `false`, the commit labels are not shown in the diagram.
- `mainBranchName` : String, default is `main`. The name of the default/root branch.
- `mainBranchOrder` : Position of the main branch in the list of branches. default is `0`, meaning, by default `main` branch is the first in the order.
- `parallelCommits`: Boolean, default is `false`. If set to `true`, commits x distance away from the parent are shown at the same level in the diagram.

Let's look at them one by one.

Expand Down Expand Up @@ -915,6 +916,62 @@ Usage example:
commit
```

## Parallel commits (v10.8.0+)

Commits in Mermaid display temporal information in gitgraph by default. For example if two commits are one commit away from its parent, the commit that was made earlier is rendered closer to its parent. You can turn this off by enabling the `parallelCommits` flag.

### Temporal Commits (default, `parallelCommits: false`)

```mermaid-example
%%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'parallelCommits': false}} }%%
gitGraph:
commit
branch develop
commit
commit
checkout main
commit
commit
```

```mermaid
%%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'parallelCommits': false}} }%%
gitGraph:
commit
branch develop
commit
commit
checkout main
commit
commit
```

### Parallel commits (`parallelCommits: true`)

```mermaid-example
%%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'parallelCommits': true}} }%%
gitGraph:
commit
branch develop
commit
commit
checkout main
commit
commit
```

```mermaid
%%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'parallelCommits': true}} }%%
gitGraph:
commit
branch develop
commit
commit
checkout main
commit
commit
```

## Themes

Mermaid supports a bunch of pre-defined themes which you can use to find the right one for you. PS: you can actually override an existing theme's variable to get your own custom theme going. Learn more about theming your diagram [here](../config/theming.md).
Expand Down
33 changes: 33 additions & 0 deletions packages/mermaid/src/docs/syntax/gitgraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ In Mermaid, you have the option to configure the gitgraph diagram. You can confi
- `showCommitLabel` : Boolean, default is `true`. If set to `false`, the commit labels are not shown in the diagram.
- `mainBranchName` : String, default is `main`. The name of the default/root branch.
- `mainBranchOrder` : Position of the main branch in the list of branches. default is `0`, meaning, by default `main` branch is the first in the order.
- `parallelCommits`: Boolean, default is `false`. If set to `true`, commits x distance away from the parent are shown at the same level in the diagram.

Let's look at them one by one.

Expand Down Expand Up @@ -568,6 +569,38 @@ Usage example:
commit
```

## Parallel commits (v10.8.0+)

Commits in Mermaid display temporal information in gitgraph by default. For example if two commits are one commit away from its parent, the commit that was made earlier is rendered closer to its parent. You can turn this off by enabling the `parallelCommits` flag.

### Temporal Commits (default, `parallelCommits: false`)

```mermaid-example
%%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'parallelCommits': false}} }%%
gitGraph:
commit
branch develop
commit
commit
checkout main
commit
commit
```

### Parallel commits (`parallelCommits: true`)

```mermaid-example
%%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'parallelCommits': true}} }%%
gitGraph:
commit
branch develop
commit
commit
checkout main
commit
commit
```

## Themes

Mermaid supports a bunch of pre-defined themes which you can use to find the right one for you. PS: you can actually override an existing theme's variable to get your own custom theme going. Learn more about theming your diagram [here](../config/theming.md).
Expand Down

0 comments on commit ddf85c3

Please sign in to comment.