When Mermaid, reads the merge keyword, it finds the given branch and its head commit (the last commit on that branch), and joins it with the head commit on the current branch. Also, you can only merge two separate branches, and cannot merge a branch with itself. If no branch is found with the given name, it will result in console error. You also need to provide the name of an existing branch to merge from. In Mermaid, in order to merge or join to an existing branch, you make use of the merge keyword. After this we made use of the checkout keyword to set the current branch as main, and all commit that follow are registered against the current branch, i.e. Then we created the develop branch, and all three commits afterwards are put on the develop branch as it became the current branch. In this example, see how we started with default main branch, and pushed two commits on that. Let see how this works:Ī simple gitgraph showing three commits on the default ( main) branch: Code: You make use of commit keyword to register a commit on the current branch. And by-default, main branch is set as your current branch. This is driven with how git works, where in the beginning you always start with the main branch (formerly called as master branch). So unless you create a different branch, by-default the commits will go to the main branch. This gitgraph keyword, tells Mermaid that you wish to draw a gitgraph, and parse the diagram code accordingly.Įach gitgraph, is initialized with main branch. Basically, it follows the insertion order for each command.įirst thing you do is to declare your diagram type using the gitgraph keyword. It follows a declarative-approach, where each commit is drawn on the timeline in the diagram, in order of its occurrences/presence in code. Mermaid syntax for a gitgraph is very straight-forward and simple. Entity names are often capitalized, although there is no accepted standard on this, and it is not required in Mermaid. With the help of these key git commands, you will be able to draw a gitgraph in Mermaid very easily and quickly. merge : To merge an existing branch onto the current branch.checkout : To checking out an existing branch and setting it as the current branch. branch : To create & switch to a new branch, setting it as the current branch.commit : Representing a new commit on the current branch.In Mermaid, we support the basic git operations like:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |