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
DiagramGitGraphDiagram
Constructors
| Name | Description |
|---|---|
| GitGraphDiagram() |
GitGraphDiagram()
GitGraphDiagram.cspublic GitGraphDiagram()No documentation is available.
Properties
| Name | Description |
|---|---|
| BranchColors | Gets the colors of the branches, by position of the branch, which replace the colors of the theme (Mermaid git0...git7). |
| BranchLabelColors | Gets the colors of the names of the branches, by position of the branch (Mermaid gitBranchLabel0...). |
| CommitLabelBackground | Gets or sets the background of the identifiers of the commits, or null for the color of the theme. |
| CommitLabelColor | Gets or sets the color of the identifiers of the commits, or null for the color of the theme. |
| HighlightColors | Gets the colors of the highlighted commits, by position of the branch (Mermaid gitInv0...). |
| MainBranchName | Gets or sets the name of the branch the history starts on. The default is main. |
| MainBranchOrder | Gets or sets the position of the main branch among the branches, which are sorted by their order. The default is 0. |
| Operations | Gets the operations that build the history, in order. |
| Orientation | Gets or sets the direction of the history. The default is GitGraphOrientation.LeftToRight. |
| ParallelCommits | 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. |
| RotateCommitLabels | Gets or sets a value that indicates whether the identifiers of the commits are rotated by 45 degrees. The default is true. |
| ShowBranches | Gets or sets a value that indicates whether the branches are drawn: their names and their lines. The default is true. |
| ShowCommitLabels | Gets or sets a value that indicates whether the identifiers of the commits are drawn. The default is true. |
| TagLabelBackground | Gets or sets the background of the tags, or null for the color of the theme. |
| TagLabelBorder | Gets or sets the border of the tags, or null for the color of the theme. |
| TagLabelColor | Gets or sets the color of the tags, or null for the color of the theme. |
BranchColors
GitGraphDiagram.csGets 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; }Property value
BranchLabelColors
GitGraphDiagram.csGets the colors of the names of the branches, by position of the branch (Mermaid gitBranchLabel0...).
public IDictionary<int, SceneColor> BranchLabelColors { get; }Property value
CommitLabelBackground
GitGraphDiagram.csGets 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
CommitLabelColor
GitGraphDiagram.csGets 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
HighlightColors
GitGraphDiagram.csGets the colors of the highlighted commits, by position of the branch (Mermaid gitInv0...).
public IDictionary<int, SceneColor> HighlightColors { get; }Property value
MainBranchName
GitGraphDiagram.csMainBranchOrder
GitGraphDiagram.csOperations
GitGraphDiagram.csGets the operations that build the history, in order.
public IList<GitGraphOperation> Operations { get; }Property value
Orientation
GitGraphDiagram.csGets or sets the direction of the history. The default is GitGraphOrientation.LeftToRight.
public GitGraphOrientation Orientation { get; set; }Property value
ParallelCommits
GitGraphDiagram.csRotateCommitLabels
GitGraphDiagram.csShowBranches
GitGraphDiagram.csShowCommitLabels
GitGraphDiagram.csTagLabelBackground
GitGraphDiagram.csGets or sets the background of the tags, or null for the color of the theme.
public SceneColor? TagLabelBackground { get; set; }Property value
TagLabelBorder
GitGraphDiagram.csGets or sets the border of the tags, or null for the color of the theme.
public SceneColor? TagLabelBorder { get; set; }Property value
TagLabelColor
GitGraphDiagram.csGets or sets the color of the tags, or null for the color of the theme.
public SceneColor? TagLabelColor { get; set; }Property value
Methods
| Name | Description |
|---|---|
| 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.csCreates a branch from the current commit, and checks it out.
public GitGraphBranch Branch(string name, int? order = null)Parameters
namestring- The name of the branch.
orderint?- The position of the branch among the branches, or
nullfor the order of creation.
Returns
GitGraphBranch The operation.
Checkout(string)
GitGraphDiagram.csMakes a branch the current branch.
public GitGraphCheckout Checkout(string branch)CherryPick(string, string?)
GitGraphDiagram.csCopies a commit of another branch onto the current branch.
public GitGraphCherryPick CherryPick(string commitId, string? parent = null)Parameters
commitIdstring- The identifier of the commit to copy.
parentstring?- The parent of a merge commit to copy the changes from, or
null.
Returns
GitGraphCherryPick The operation.
Commit(string?, GitGraphCommitType, IEnumerable<string>)
GitGraphDiagram.csAdds a commit on the current branch.
public GitGraphCommit Commit(string? id = null, GitGraphCommitType type = GitGraphCommitType.Normal, params IEnumerable<string> tags)Parameters
idstring?- The identifier, or
nullto generate one. typeGitGraphCommitType- The type.
tagsIEnumerable<string>- The tags.
Returns
GitGraphCommit The commit.
Merge(string, string?)
GitGraphDiagram.csMerges a branch into the current branch.
public GitGraphMerge Merge(string branch, string? id = null)Parameters
branchstring- The name of the branch to merge.
idstring?- The identifier of the merge commit, or
nullto generate one.
Returns
GitGraphMerge The operation.