Syntax for branching and merging diagrams

Getting started with an example

  • Both branching and merging is indicated by an arrow “->”
  • Every branch, merge and commit must be finished with a semicolon “;”
  • The default branch is called trunk – you must start branching from it.
  • If the branch name on the right hand side of the arrow is not known to the system before then a new branch will be created
  • If the branch name on the right hand side of the arrow is known to the system then the merge will be performed
trunk -> branch1;
branch1 -> trunk;

branch-merge-simple

Branch names

Branch names can be represented by:

  • a single word (e.g. branch1) OR
  • multiple words surrounded by double quotes (“feature branch 2”)
trunk -> branch1;
trunk -> "feature branch 2";
"feature branch 2" -> branch1;

branch-merge-longer

Branch location and coordinate system

By default a new branch will be created pointing down, however it is possible to control the layout of the branches by adding extra instructions.

The trunk branch is at location 0. The branches below trunk have integer numbers. Branches above trunk have negative integer numbers.

default branching – find the next free row below the source branch ‘trunk’:

trunk -> branch1;

down – new branch ‘branch2’ is created just below source branch ‘trunk’:

trunk -> branch2 down;

up – new branch ‘branch3’ is created just above the source branch ‘trunk’:

trunk -> branch3 up;

up [number] – new branch ‘branch4’ is created 2 levels above the source branch ‘branch3’:

branch3 -> branch4 up 2;

down [number] – new branch ‘branch5’ is created 2 levels below the source branch ‘branch4’:

branch4 -> branch5 down 2;

[number] – new branch ‘branch6’ is created at level 3 (below trunk):

branch4 -> branch6 3;

[number] – new branch ‘branch7’ is created at level -2 (above trunk):

branch6 -> branch7 -2

Full example

trunk -> branch1;
trunk -> branch2 down;
trunk -> branch3 up;
branch3 -> branch4 up 2;
branch4 -> branch5 down 2;
branch4 -> branch6 3;
branch6 -> branch7 -2;

branch-locations

Commits

  • Commit is indicated by a colon “:”
  • Commit message should be surrounded by double quotes.
  • Do not forget semicolon;
trunk -> branch1;
branch1 : "this is a commit message";
branch1 -> trunk;

branch-commit