Conflicts and merging
Published 16 J 2015
Conflicts happen when the latest version of an object in source control and the latest version in the database are incompatible. This happens if two people modify the same object. Conflicted objects can't be committed or retrieved until the conflict is resolved. To avoid conflicts, we recommend you get the latest version of an object before modifying it.
When a conflict happens, the Conflict to resolve bar is shown beneath the change list:
To resolve a conflict, choose either:
- Keep mine
When you click Commit, your version of the object is committed to source control.
- Take theirs
The object can't be committed. To get the source control version of the object, go to the Get latest tab.
Conflicts involving data
If an object has both schema and data changes, you need to commit or get the latest schema and data changes at the same time. You can't only commit the data changes. This is because data changes may fail without the associated schema changes. This means if an unconflicted data change is associated with a conflicted object, you can't commit or get the data change without resolving the schema conflict first.
Merging conflicted stored procedures from SQL Source Control with Beyond Compare 3 or KDiff3
SQL Source Control doesn't have merge functionality. However, you can use the third-party tools Beyond Compare 3 or KDiff3 to merge conflicting stored procedures from SQL Source Control.
You can request support for other object types on the SQL Source Control feedback page.
To merge conflicting stored procedures:
- Select the conflicted stored procedure and click Merge in the conflict resolution bar:
Beyond Compare 3 or KDiff3 opens. If both Beyond Compare 3 and KDiff3 are installed, SQL Source Control opens Beyond Compare 3.
Management Studio is disabled while the merge tool is open.
Merge and save the change in the merge tool.
When you close the merge tool, your original change will be replaced with the change from the merge tool..
Close the merge tool.
The output from the merge tool is immediately executed on the database. This happens before you commit or get latest.
If the output is different from the version in source control, Keep mine is automatically selected and the change is ready to be committed or retrieved.
Merged conflicts are still listed as unresolved until you commit or retrieve them.
If the output is identical to the version in source control, there are no longer any changes to commit or get for that object. The object is removed from the change list.
Merging other objects
To merge changes from two conflicting versions of an object, resolve the conflict, and then manually edit the object to include the changes from the other version.