Main Content

Identify Order of Resolving Conflicts in Changeset

This example shows how to determine the optimal order, if it exists, when you resolve conflicts in a changeset that contains multiple conflicted files.

Open the example to download the supporting files. The repository has two conflicted model files. To make the changes that caused the conflicts yourself instead, see Make Changes and Merge Git Local Branch.

In a repository, whether a folder or a MATLAB® project, a branch merge can lead to conflicted files.

For a smoother merge, determine the optimal order in which to resolve conflicts by running a dependency analysis. Conflicts in files that are used by other files should be resolved first. Conflicts in files that do not have dependencies do not affect other files, so the conflict resolve order does not matter. To determine the optimal order to resolve conflicted files, provide the repository path that contains conflicts to run the getResolveOrderInFolder utility function that this example provides.

repoFolderPath = gitrepo("models").WorkingFolder;
filesResolveOrder = getResolveOrderInFolder(repoFolderPath)
filesResolveOrder = 

  2×1 string array


In this example repository, resolve the conflicts in the sldemo_mdlref_counter.slx model before you resolve the conflicts in the sldemo_mdlref_basic.slx model. The dependency graph shows that sldemo_mdlref_counter.slx is used by sldemo_mdlref_basic.slx. For information on how to run a dependency analysis interactively, see Dependency Analyzer.

See Also

Related Examples

More About