Creating a New Branch
You can select any commit on a branch to create a new branch from that source commit. This starts a new sequence of commits that runs in parallel with the first sequence. When the branch is created, the collections of versions and assigned tags will be identical in the source commit and on the new branch. But as soon as you start saving new versions and reassigning tags, the branches will diverge. See Figure 4-1, which is a continuation of Figure 2-2, for a schematic representation.
Prefer using Save as New () if you want to create a copy of a model. Changes to the copy can later be merged to the original model via the Comparison Result window. See Saving Models to Databases and Comparing a Version With the Opened Model in the COMSOL Desktop.
A good mental picture is to think of a tree in which the initial branch is the trunk of the tree, with an initial commit saved at the base of the trunk (at the ground), and successive commits stacked on top of each other. Other branches created off the main branch correspond to tree branches shooting out from the trunk. A repository can be thought of as the tree itself.
Figure 4-1: A schematic representation of a repository containing two branches. A second branch has been created off the main branch’s second commit. In the third commit on the main branch, the model A was deleted. On the new branch’s second commit, a new version of model A was instead saved. Browsing the latest versions on the main branch will return model versions B3 and C1. Browsing on the new branch will return A3 and B1.
To create a branch from a particular source commit, do one of the following:
Select a branch node () in the The Databases Tree and click the Branch button () in the Repository section of the Database toolbar. The source commit is the latest commit on the branch.
Select a snapshot node () in the The Databases Tree and click the Branch button () in the Repository section of the Database toolbar. The source commit is the commit that the snapshot references.
Select a commit table row in the The Commits Window and click the Branch button () in the window’s toolbar.
In all cases, The Create Branch Dialog Box is opened.
Partial Branches
You can create a partial branch that contains a subset of all items that were present in the source commit. Select models and files in The Databases Tree or The Model Manager Window to include those items in the new branch. Select tags to include all items that are tagged by the selected tag. All tag assignments present in the source commit will be mirrored on the new branch as well.
The Create Branch Dialog Box
You create the new branch from the Create Branch dialog box. The Database field shows the database in which the branch is created, and the Repository field shows the repository that the source commit and new branch both belong to.
1
2
3
Select Item fields and content in the Search list for complete search and filter support on the new branch; otherwise, select Only item fields — see also Searching in Branches.
4
In the Selection list:
-
Select All to include all items from the source commit.
-
Select Current selection to only include the items whose versions were selected when the dialog box was opened. The selected item versions are displayed in a table under the Selection field. Select a table row and click the Exclude button () to exclude the item from the new branch.
-
Select Empty to create a branch that does not include any initial items at all.
5
You can set up permissions for the new branch in the Permissions field. This field is only shown if connected to a server database via a Model Manager server. See Granting Permissions.
6
Click OK to create the new branch in the database.
The created branch appears as a new child node to the Branches node in The Databases Tree.
An initial commit is always made on a new branch. If you open The Commit Details Dialog Box for this commit you will see that the Changes table is, however, empty — no new versions or tag assignments are saved in the database in that initial commit.