SQL Source Control 6

Resolve and merge conflicts

Conflicts happen when two people change 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.

Resolving a conflict

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 migration scripts

If objects in a migration script have changed locally, when you use the Get latest tab to retrieve the script, you'll encounter a conflict. To resolve this conflict:

  1. On the commit tab, select Take theirs.
  2. Go to the Get latest tab and retrieve the migration script.
    This discards local changes to the object.
  3. Repeat the changes to the object locally.
  4. Commit the changes.

Conflicts involving static data

This only applies if you're source-controlling static data.

If you've made both schema and data changes to an object, you need to commit both changes at the same time. If someone else has made both schema and data changes to an object, you need to get both changes at the same time. This is because data changes may not work without the associated schema changes. 

This means that, for objects where there's a schema conflict, if there's a data change on that object, you can't commit or get the data change without resolving the schema conflict first.

Merge conflicted stored procedures (using Beyond Compare 3 or KDiff3)

You can't merge conflicts using SQL Source Control itself. However, you can use the third-party tools Beyond Compare 3 or KDiff3 to merge conflicting stored procedures.

You can request support for other object types on the SQL Source Control feedback page.

To merge conflicting stored procedures:

  1. 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, Beyond Compare 3 will open.

    Management Studio is disabled while the merge tool is open.

  2. 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.
  3. 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.

Merge 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.

You can copy either version of an object's creation script from the Object Differences pane, and paste it into a new query window.

Didn't find what you were looking for?