The Merge Window
You use the Merge window to select and merge item changes made on a source branch, up to a particular source commit, to a target branch.
The Source field shows the location corresponding to the source commit for which the window was opened. Click the link button to select a new branch or snapshot as source in The Select Location Dialog Box. The Target field shows the location corresponding to the target branch for the merge. Click the link button to select another branch.
The window contains a table with item changes made on the source branch that are not present in the target branch. The table columns are:
The type column — the type of the changed item represented by an icon.
The Source Change column — a description of the item change.
The Conflicting Target Changes column — one or more changes on the target branch that are incompatible, or in conflict, with the source change.
The Selection column — an icon representing whether to include the source change (), ignore the source change (), or if there is a conflict ().
Click the Merge Changes button () to open The Merge Dialog Box after you have decided which changes to merge and resolved any merge conflicts.
The Merge Window Toolbar
The toolbar in the Merge window contains the following toolbar buttons:
Click the Refresh button () to refresh the table in case any new commits have been saved on the target branch.
Click the Take Source button () to include a source change in the merge. This is the default choice.
Click the Keep Target button () to ignore a source change, keeping the target as is.
Click the Merge Changes button () to open the The Merge Dialog Box.
Resolving Merge Conflicts
When you work with a collection of items with versions on multiple branches, you will inevitably encounter conflicting changes when merging from a source branch to a target branch. Such merge conflicts can arise, for example, when:
Merge conflicts are indicated in the Selection icon column by (). Select the table row and click the Take Source button () to overwrite all conflicting changes on the target branch with the corresponding source change. Click the Keep Target button () to keep the target unchanged by skipping the source change.
Merging Conflicting Model Updates
The all or nothing choice for including a source change may be too coarse when a model has been updated on both branches. The model version on the source branch and the model version on the target branch can contain independent updates to the model tree, and it would then makes sense to incorporate both updates in a merged model version on the target branch. You can proceed as follows:
1
2
Select the model version on the source branch in The Model Manager Window and click the Compare button () in the Item section of the Home toolbar.
The Comparison Result window is opened with a comparison between the model in the COMSOL Desktop — that is, the target model version — and the selected source model version.
3
4
From the File menu, select Save as Version ().
5
Save a new version of the model to the target branch from the Save window. This becomes the merged model version.
6
Click the Refresh button () in the Merge window’s toolbar to recompute source and target branch changes.
7
If there is more than one update conflict between a model version on the source branch and the target branch, repeat these steps for each one. Once finished, finish the merge by clicking Merge Changes ().
The Merge Dialog Box
The Merge dialog box gives you a final chance to either go through with the merge or cancel it (except for any manually merged model versions already saved on the target branch — see Merging Conflicting Model Updates). The Source location field shows the location of the source commit, and the Target location field shows the target branch. You can write an optional comment in the Comments field for the commit created by the merge.
The table shows all changes that will be applied to the target branch by the merge commit. These changes may differ from the original source changes shown in the Merge window depending on which changes were included, which were skipped, and potential merge conflict resolutions.
Click OK to merge the changes in the database.
Once a source commit has been merged into a target branch, any changes on the source branch that were skipped will not show up in the Merge window the next time you open the window for a newer source commit. To include such older source changes, manually perform them on the target branch.
You may find the number of source changes in the Merge window overwhelming if there has been many commits on the source branch. One solution is to first merge from an older commit on the source branch, and then progressively work yourself up to the latest commit. One drawback is that this requires more than one merge commit on the target branch, which may unnecessarily pollute the commit history on that branch.