GitGraphDiagram Class

A Git graph: the commits of branches, their merges and their cherry-picks, written as the Git commands that create them (Mermaid gitGraph). The GitGraphDiagram.Operations run in order from an empty repository whose current branch is GitGraphDiagram.MainBranchName.

public sealed class GitGraphDiagram : Diagram
Inheritance
Diagram GitGraphDiagram

Constructors

NameDescription
GitGraphDiagram()

GitGraphDiagram()

GitGraphDiagram.cs
public GitGraphDiagram()

No documentation is available.

Properties

NameDescription
BranchColorsGets the colors of the branches, by position of the branch, which replace the colors of the theme (Mermaid git0...git7).
BranchLabelColorsGets the colors of the names of the branches, by position of the branch (Mermaid gitBranchLabel0...).
CommitLabelBackgroundGets or sets the background of the identifiers of the commits, or null for the color of the theme.
CommitLabelColorGets or sets the color of the identifiers of the commits, or null for the color of the theme.
HighlightColorsGets the colors of the highlighted commits, by position of the branch (Mermaid gitInv0...).
MainBranchNameGets or sets the name of the branch the history starts on. The default is main.
MainBranchOrderGets or sets the position of the main branch among the branches, which are sorted by their order. The default is 0.
OperationsGets the operations that build the history, in order.
OrientationGets or sets the direction of the history. The default is GitGraphOrientation.LeftToRight.
ParallelCommitsGets or sets a value that indicates whether a commit is placed right after its parent, so the commits of different branches made at the same time are side by side; otherwise, each commit has its own position, in order.
RotateCommitLabelsGets or sets a value that indicates whether the identifiers of the commits are rotated by 45 degrees. The default is true.
ShowBranchesGets or sets a value that indicates whether the branches are drawn: their names and their lines. The default is true.
ShowCommitLabelsGets or sets a value that indicates whether the identifiers of the commits are drawn. The default is true.
TagLabelBackgroundGets or sets the background of the tags, or null for the color of the theme.
TagLabelBorderGets or sets the border of the tags, or null for the color of the theme.
TagLabelColorGets or sets the color of the tags, or null for the color of the theme.

BranchColors

GitGraphDiagram.cs

Gets the colors of the branches, by position of the branch, which replace the colors of the theme (Mermaid git0...git7).

public IDictionary<int, SceneColor> BranchColors { get; }

BranchLabelColors

GitGraphDiagram.cs

Gets the colors of the names of the branches, by position of the branch (Mermaid gitBranchLabel0...).

public IDictionary<int, SceneColor> BranchLabelColors { get; }

CommitLabelBackground

GitGraphDiagram.cs

Gets or sets the background of the identifiers of the commits, or null for the color of the theme.

public SceneColor? CommitLabelBackground { get; set; }

Property value

SceneColor?

CommitLabelColor

GitGraphDiagram.cs

Gets or sets the color of the identifiers of the commits, or null for the color of the theme.

public SceneColor? CommitLabelColor { get; set; }

Property value

SceneColor?

HighlightColors

GitGraphDiagram.cs

Gets the colors of the highlighted commits, by position of the branch (Mermaid gitInv0...).

public IDictionary<int, SceneColor> HighlightColors { get; }

MainBranchName

GitGraphDiagram.cs

Gets or sets the name of the branch the history starts on. The default is main.

public string MainBranchName { get; set; }

Property value

string

MainBranchOrder

GitGraphDiagram.cs

Gets or sets the position of the main branch among the branches, which are sorted by their order. The default is 0.

public double MainBranchOrder { get; set; }

Property value

double

Gets the operations that build the history, in order.

public IList<GitGraphOperation> Operations { get; }

Gets or sets the direction of the history. The default is GitGraphOrientation.LeftToRight.

public GitGraphOrientation Orientation { get; set; }

Property value

GitGraphOrientation

ParallelCommits

GitGraphDiagram.cs

Gets or sets a value that indicates whether a commit is placed right after its parent, so the commits of different branches made at the same time are side by side; otherwise, each commit has its own position, in order.

public bool ParallelCommits { get; set; }

Property value

bool

RotateCommitLabels

GitGraphDiagram.cs

Gets or sets a value that indicates whether the identifiers of the commits are rotated by 45 degrees. The default is true.

public bool RotateCommitLabels { get; set; }

Property value

bool

ShowBranches

GitGraphDiagram.cs

Gets or sets a value that indicates whether the branches are drawn: their names and their lines. The default is true.

public bool ShowBranches { get; set; }

Property value

bool

ShowCommitLabels

GitGraphDiagram.cs

Gets or sets a value that indicates whether the identifiers of the commits are drawn. The default is true.

public bool ShowCommitLabels { get; set; }

Property value

bool

TagLabelBackground

GitGraphDiagram.cs

Gets or sets the background of the tags, or null for the color of the theme.

public SceneColor? TagLabelBackground { get; set; }

Property value

SceneColor?

TagLabelBorder

GitGraphDiagram.cs

Gets or sets the border of the tags, or null for the color of the theme.

public SceneColor? TagLabelBorder { get; set; }

Property value

SceneColor?

TagLabelColor

GitGraphDiagram.cs

Gets or sets the color of the tags, or null for the color of the theme.

public SceneColor? TagLabelColor { get; set; }

Property value

SceneColor?

Methods

NameDescription
Branch(string, int?)Creates a branch from the current commit, and checks it out.
Checkout(string)Makes a branch the current branch.
CherryPick(string, string?)Copies a commit of another branch onto the current branch.
Commit(string?, GitGraphCommitType, IEnumerable<string>)Adds a commit on the current branch.
Merge(string, string?)Merges a branch into the current branch.

Branch(string, int?)

GitGraphDiagram.cs

Creates a branch from the current commit, and checks it out.

public GitGraphBranch Branch(string name, int? order = null)

Parameters

name string
The name of the branch.
order int?
The position of the branch among the branches, or null for the order of creation.

Returns

GitGraphBranch The operation.

Checkout(string)

GitGraphDiagram.cs

Makes a branch the current branch.

public GitGraphCheckout Checkout(string branch)

Parameters

branch string
The name of the branch.

Returns

GitGraphCheckout The operation.

CherryPick(string, string?)

GitGraphDiagram.cs

Copies a commit of another branch onto the current branch.

public GitGraphCherryPick CherryPick(string commitId, string? parent = null)

Parameters

commitId string
The identifier of the commit to copy.
parent string?
The parent of a merge commit to copy the changes from, or null.

Returns

GitGraphCherryPick The operation.

Commit(string?, GitGraphCommitType, IEnumerable<string>)

GitGraphDiagram.cs

Adds a commit on the current branch.

public GitGraphCommit Commit(string? id = null, GitGraphCommitType type = GitGraphCommitType.Normal, params IEnumerable<string> tags)

Parameters

id string?
The identifier, or null to generate one.
type GitGraphCommitType
The type.
tags IEnumerable<string>
The tags.

Returns

GitGraphCommit The commit.

Merge(string, string?)

GitGraphDiagram.cs

Merges a branch into the current branch.

public GitGraphMerge Merge(string branch, string? id = null)

Parameters

branch string
The name of the branch to merge.
id string?
The identifier of the merge commit, or null to generate one.

Returns

GitGraphMerge The operation.