Work with branches
A branch is a separate, named line of work in a model. Every model has main. You can add branches beside it, for example to prepare a larger change and merge it into main once it has been reviewed. For how branches and your draft fit together, see Drafts & branches.
Prerequisites
Section titled “Prerequisites”- A model you can edit.
- To switch branches or create one: no changes in your draft. Commit or discard them first; see Work in a draft and commit.
- A service account with Write access can create, compare and merge branches through the API; deleting a branch needs Allow this account to delete models. See Set up a service account.
Open the branch menu
Section titled “Open the branch menu”The branch control sits at the right end of the bar at the top of every page of the model. It shows the name of the branch you have open, such as v3. While main is the model’s only branch and you are on it, it shows only a branch icon and an arrow; the name returns as soon as the model has a second branch. Point at it to read what the branch is, for example “main is the shared version of this model that everyone sees”. Select it to open the branch menu. Under Branches it lists the model’s branches, main first, each with when its last commit was made and by whom, for example “Last commit 15 minutes ago by you”. A check marks the branch you are on, and every other row has a … button with more actions. On any branch other than main, the row of the branch you are on has the … button too, with Review and merge into main and Delete branch, and Review and merge into main also sits at the bottom of the menu. At the bottom, New branch from main creates a branch; it names the branch you are on.

Switch to another branch
Section titled “Switch to another branch”- Open the branch menu.
- Select the branch you want.
The model opens on that branch. The editor, the diagrams, the history, the validation report, and the Query page now show it, and its name appears in the bar at the top. The page’s address carries the branch name, as ?branch= followed by the name, so a bookmark or a shared link opens the same branch. To go back, switch to main the same way. A switch is not a step in the browser history: the browser’s Back button does not switch back.
- If your draft holds pending changes, the menu says Commit or discard your changes on main first and you cannot switch, because your draft belongs to the branch it was started on.
- If the element form or a diagram has unsaved edits, the Unsaved changes dialog asks about them first.
- A draft you emptied, for example by undoing its only change, is discarded on the way.
When someone opens a link to a branch while their own draft is on another branch, the branch of their draft opens instead.
Create a branch
Section titled “Create a branch”- Switch to the branch you want to start from, for example main.
- Open the branch menu and select New branch from main.
- In the Create branch dialog, enter a Name.
- Select Create branch.
The new branch starts as a copy of the branch you were on, as it stands now, and opens in its place. Your next edit starts a draft on the new branch.
A branch name:
- is not empty and has at most 100 characters;
- has no control characters or invisible characters;
- does not start with
draft/orgen/; - is not
main, and not the name of another branch of the model, whatever the letter case.
A branch cannot be renamed later.
Compare two branches
Section titled “Compare two branches”- Switch to the branch you want to compare against, for example main.
- Open the branch menu, select … on the other branch’s row, and select Compare with main.
Review changes opens with a title such as “v3 compared with main”. It shows what the other branch changed since the two branches split: what a merge would bring. Read it as a list or on the diagrams, as described in Review your changes. Here, Before is an element as it was where the two branches split, and After is the element as it is on the other branch. Changes made on main after the split are not shown; a line under the title says so, “Showing what v3 brings to main”, and Compare the other way beside it opens the opposite comparison, what main would bring to v3.
If both branches were merged into each other earlier, the two have no single point where they split, and the review says so in place of the changes: neither can be compared with or merged into the other until you delete one of them and create it again from the other, or create a new branch from one of them and redo the other’s changes there. The merge dialog refuses such a merge with the same explanation.
Merge a branch
Section titled “Merge a branch”The usual way is from the branch you worked on: review what it brings to main, resolve any conflicts there, and merge.
- Switch to the branch to merge, for example v3.
- Open the branch menu and select Review and merge into main, at the bottom of the menu or in the … menu of the current branch’s row. Review changes opens comparing v3 with main.
- Check the changes. If the two branches changed the same elements in ways that cannot be combined, a panel such as “v3 cannot be merged into main as it stands” lists them above the changes; resolve them as described in Resolve conflicts on the review screen.
- Select Merge into main, or, after resolving conflicts, Merge with these choices.
On the review screen every change is ticked at first, removals included. Untick a change, or a single property of a changed element, to leave it out of the merge; the button then reads Merge selected into main.
A message confirms, for example, “Merged v3 into main”. The merge lands as one merge commit on main, and v3 stays as it is. Only committed changes are merged; changes still in someone’s draft are not. If v3 has nothing main does not already have, the button says so and nothing is merged.
The merge takes the changes as the review read them. If either branch changed in the meantime, nothing is merged, and the review says so, for example “v3 changed since these changes were read, so nothing was merged. The comparison has been reloaded: review the changes as they are now, then merge again.” If main keeps moving while the merge is made, it says “main kept moving while the merge was made. Try again.”
When the merge would change the dependencies or the metamodel version of the branch it merges into, the review screen lists those changes above the list of changed elements, under Dependencies changed, one line each:
- “Adds Imbor (2.2)”: a dependency the merge adds, with its version;
- “Removes NEN 3610”: a dependency the merge removes;
- “Changes Imbor from 2.1 to 2.2”: a dependency the merge moves to another version;
- “Changes the metamodel version from 3.0 to 3.1”, or “Changes the metamodel extension NL-SBB from 1.0 to 1.1”: a metamodel version the merge moves.
A published version reads as its name, and the current working version of a model as Snapshot and a short commit id, such as Snapshot 3f9a2c1d. Only the dependencies your model declares are listed: the ones they bring along follow them. See Dependencies on a branch.
If the model the merge would produce fails validation, a panel above the changes says “The merged model would fail validation”, lists why, and Merge into main is unavailable. This is not a conflict between the branches, and no choice of versions resolves it. Change either branch so the merged model passes, then select Check again.
You can also merge in the other direction, into the branch you have open, with a message for the merge commit:
- Switch to the branch that should receive the changes, for example main.
- Open the branch menu, select … on the branch to merge, and select Merge into main.
- In the dialog, for example Merge v3 into main, optionally enter a Message, up to 2000 characters.
- Select Merge.
If your own draft holds pending changes when the merge lands, the draft chip then says the branch was updated. See Bring your draft up to date.
When a merge has conflicts
Section titled “When a merge has conflicts”When both branches changed the same element in ways that cannot be combined, nothing is merged. On the review screen the conflicts are listed as soon as the comparison opens, before you merge. In the merge dialog, the merge is refused and the dialog lists each conflicting element with its reason:
- changed on both branches;
- changed on one branch and deleted on the other;
- its owner was deleted on the other branch;
- it refers to an element deleted on the other branch;
- it is pinned to a different version on each branch;
- it refers to content of a dependency removed on the other branch.
You can resolve the conflicts on the review screen, as described below. Or select Open v3 to switch to the other branch, change those elements there, commit, and merge again.
Resolve conflicts on the review screen
Section titled “Resolve conflicts on the review screen”- Open the comparison: select Review and merge into main on the branch, or, in the merge dialog, Resolve on the review screen. Review changes opens comparing the two branches, with a panel such as “v3 cannot be merged into main as it stands” above the list, or “v3 was not merged into main” after a merge was refused.
- For each conflicting element, choose which version to keep: Use main or Use v3. The table under it shows each property that differs, with its value where the branches split (Base) and on each branch. Where it offers a choice per property, you can pick a side for each property instead. When the element sits in a different place on each branch, an Owner row shows where. A branch that does not hold the element reads Not on main or Not on v3 in its column.
- To take one side for every element at once, select Use main for all or Use v3 for all. A line beside these buttons says how many elements still need a choice.
- Select Merge with these choices. It becomes available once every element has a choice. At most 1000 choices can differ from the side you took for the rest; past that, the panel says “Too many individual choices to send at once” and the merge is not sent.
The merge lands as one merge commit. If a choice cannot be applied, for example because it keeps a reference to an element that another choice removes, nothing is merged: that element says why, and you change its choice and merge again. If one of the branches changed in the meantime, the comparison reloads and shows the conflicts as they are now, with a line saying which branch changed; choose again and merge.
A dependency that the two branches pin to different versions is one conflict: its card says “Is pinned to a different version on each branch”, and a Version row shows the version where the branches split (Base) and on each branch. Choose Use main or Use v3 to take that branch’s version whole; a version cannot be split. The dependencies it brings along follow the version you pick, and are no conflicts of their own.
An element whose card says “Refers to content of a dependency removed on the other branch” points at content the merged model no longer has. Choose the version of the element that does not refer to it. If you choose a version that still does, nothing is merged and the element says why. If you need that content, add the dependency again on the branch, commit, and merge again.
See merges in the history
Section titled “See merges in the history”The History page lists the commits of the branch you have open. A merge commit reads, for example, “Merged v3 into main”, and under Parents it links to the two commits it joined, such as “e43e81b1 on main, 7ccd30ee on v3”.
Delete a branch
Section titled “Delete a branch”- Open the branch menu, select … on the branch, and select Delete branch. You can delete any branch except main, including the one you are on.
- The dialog, for example Delete v3, says what goes with the branch: “Deleting v3 deletes only the branch. No one has a draft on it.”, or how many drafts on it are deleted too. Drafts deleted with a branch cannot be recovered, whoever they belong to. It also says whether the branch’s commits are on main: “Everything committed on v3 is on main.”, or for example “2 commits on v3 are not on main. They are lost with the branch.” Merge the branch first if you want to keep them.
- Select Delete branch. If the branch changed since the menu listed it, the dialog says so, shows what goes with it now, and asks you to select Delete branch again.
The branch and every draft on it are removed. Changes already merged from it stay where they were merged; commits that were not on main are gone. If you deleted the branch you were on, main opens in its place.
If someone else deletes the branch you have open, main opens and a message says, for example, “Branch v3 was deleted; showing main”. Edits that were still on their way to your draft are not saved, and your draft on that branch is gone with it.
Dependencies on a branch
Section titled “Dependencies on a branch”On any branch you can add, update and remove the dependencies of your model on the Model settings page. These changes go into your draft like your other edits: the Dependencies section reads Goes into your draft, and its table shows the dependencies of the branch you have open, with your pending changes in it. They reach the branch when you commit. See Manage dependencies.
External dependencies, and the dependencies of a metamodel extension, are changed on main only.
When you merge
Section titled “When you merge”A merge brings the dependency changes of one branch into the other, with rules of its own:
- A dependency both branches added at the same version becomes one dependency.
- A dependency one branch declares directly and the other has only indirectly, through another dependency, is direct after the merge.
- The dependencies a dependency brings along are worked out again after the merge, from what the merged model declares, and the managed dependencies follow the metamodel version the merge lands. They are never conflicts of their own.
- A dependency the two branches pin to different versions is a conflict. A dependency one branch removed and the other changed is a conflict too.
- An element that refers to content of a dependency the other branch removed is a conflict, so the merge never lands a reference to content the model no longer has.
The review screen lists what the merge changes under Dependencies changed before you merge; see Merge a branch. For the conflicts, see Resolve conflicts on the review screen.
Attribute templates on a branch
Section titled “Attribute templates on a branch”On any branch you can create, edit and delete the attribute templates of your model, and change their base IRI, on the Model settings page. These changes go into your draft: the Attribute templates section reads Goes into your draft, and the changes reach the branch when you commit, so a branch can try out a template change without touching main. See Attribute templates.
When you merge:
- Templates that each branch added to a model that had none become one set, holding the templates of both branches.
- A base IRI that the two branches set differently is a conflict on the template settings. Resolve it on the review screen like any other conflict; see Resolve conflicts on the review screen.
What stays on main
Section titled “What stays on main”- Named versions are always made from
main. On another branch, the New version dialog says so. - Exports, content bundles, the Overview, and the Mappings page show
main, with a note such as “Shows main, not v3.” - The Metadata page reads and saves the metadata of
main, with the note “The metadata is read from main and saved to main, not to v3.” - The Semantic Lineage page, the Based on section of Model settings, and the Export diagrams dialog show
maintoo, with a note such as “Links, rules and counts show main, not v3.” - Some changes are made on
mainonly: lineage links and rules on the Semantic Lineage and Mappings pages, alignment working sets and AI suggestions, resolving an unresolved reference, and on the Model settings page the Based on and References sections, external dependencies, and the dependencies of a metamodel extension. On another branch their controls are disabled under a note or tooltip that reads “Changed on main only.”; select Switch to main beside the note to open the model onmain. - Metamodel extensions can be added or removed only while
mainis the model’s only branch. See Review the metamodel extensions.
See Drafts & branches for the full list.
If this goes wrong
Section titled “If this goes wrong”- The branch menu says Commit or discard your changes on main first. Your draft holds pending changes. Commit or discard them, then switch or create the branch.
- A message says Branch v3 was not found; showing main. A link named a branch the model does not have, or no longer has.
- The menu says Branches could not be listed. Select Try again, and check your connection.
- Creating a branch says A branch called v3 already exists. Choose another name. Branch names ignore letter case.
- Creating a branch says the model already has the most branches one model may hold. Delete a branch you no longer need, then try again.
- The merge dialog says main kept changing while merging. Someone committed to the branch you merge into while the merge ran. Select Merge again.
- Manage under Metamodel extensions is disabled, with Adding or removing extensions needs main to be the only branch. The line names the branches in the way. Merge into
mainwhat you want to keep from them, delete them, and make the change onmain. - The Metamodel extensions section says Origin mapping keeps generated branches for this model. ModelDesk keeps these branches for the model’s origin mapping. They are not in the branch menu and cannot be deleted, so the extensions of this model cannot be added or removed while they exist.
- A control says Changed on main only. It changes
maindirectly, so it is disabled on another branch. Select Switch to main, or switch in the branch menu, and make the change there. If Switch to main says Commit or discard your changes on v3 first, commit or discard your draft first.
Related pages
Section titled “Related pages”- Drafts & branches: how branches, drafts, and merges fit together.
- Review your changes: the screen that compares branches.
- Version your model: the history page and named versions.