Main Content

Automatically Merge Models

You can enable MATLAB® Git™ integration to automatically merge branches in your Git repository. MATLAB can automatically merge branches that contain changes in different subsystems, Stateflow® charts, and configuration sets in the same SLX file.


MATLAB automatically merges your model files and resolves conflict when you are working in different subsystems.

If you are not working in different subsystems, you need to merge and resolve conflicts manually. For more information, see Merge Simulink Models from the Comparison Report.

MATLAB Git integration automatically merges changes in a child subsystem of a modified subsystem. If the number of ports remains unchanged, child subsystems are independent of parent subsystems.

MATLAB does not report a conflict for nonfunctional changes such as, window positions, open Editor tabs, and other graphical details.

To enable automerge in your Git repository, open the .gitattributes file in your repository and add:

*.slx binary merge=mlAutoMerge
Now, when you merge branches that contain changes in non-overlapping parts of the same SLX file, MATLAB Git integration handles the merge automatically.

You can also customize external source control tools to use the MATLAB Comparison Tools and automerge functionality. For more details, see Customize External Source Control to Use MATLAB for Diff and Merge.

Related Topics