Share via


How to: Resolve Conflicts Between Two Files

Team Foundation version control file difference can create conflicts during merge, check-in pending change, or get operations. For more information, see Understanding File Differences and Conflict Types. The following steps show you how to resolve these file differences.

Required Permissions

To perform these procedures, you must have the Read permission for the item in the source tree and Check out permission for the item in the target tree set to Allow. If you are renaming the item in the target tree, you must have the Check out permission for both the source tree and the target tree set to Allow. If a lock is involved, you must have the Lock permission set to Allow. For more information, see Team Foundation Server Permissions.

Procedure

To resolve file differences

  1. On the File menu, click Source Control and then Resume Conflict Resolution.

    Note

    The Resolve Conflicts dialog box will open automatically during a merge or reconciling folder difference operation if there are any differences between the source and target branches. For more information, see How to: Merge Files and Folders or How to: Reconcile Differences Between Two Folders.

    In the Resolve Conflicts dialog box, the Conflicts section will list the files that have a conflict status. The Conflicts section provides the following information:

    • Name   Lists the name of the file.

    • Type   Lists the type of conflict: Version, Filename Collision, or Writable File. For more information, see Understanding File Differences and Conflict Types.

    • Description   Explains why the conflict exists; for example, if the source and target have both changed in a merge operation.

    • Path   Lists the version control path of the file location.

      Tip

      You can sort the columns in the Resolve Conflicts dialog box to make it easier to group by conflict type or by path. To sort the list, click the header of the column you want to sort.

  2. Follow one of these steps.

    1. Click Auto Merge All to automatically merge all of the files with conflicts.

      If you get a message that says This conflict will need to be resolved individually, you must manually accept or reject changes using the merge tool. Continue with the rest of this procedure.

    — Or —

    1. Click Resolve… to manually select merging options.

    Note

    You can select multiple files by holding down the CTRL key and clicking additional files. Also, you can press CTRL+A to select all files in the conflict list.

  3. Follow one of these steps.

    1. Multiple files   If you select to resolve multiple file conflicts at the same time, the Resolve Selected Conflicts dialog box appears. This dialog box contains up to three Resolution drop-down list boxes, one for each type of conflict being resolved: Version conflicts, Filename collisions, or Writable File. For more information, see Understanding File Differences and Conflict Types.

      Tip

      Next to the title above the drop-down list box is a number in parentheses that indicates how many conflicts of that type will be acted upon.

      Select one of the following resolutions from these drop-down list boxes:

      Resolution Options

      Description

      Merge changes for me

      Merges the file automatically. If the system detects a conflict, you must select one of the other options.

      Undo my local changes

      Disregards changes made to the file in your local workspace.

      Discard server changes

      Disregards the server version of the file that conflicts with your local workspace version.

      Click OK.

    — Or —

    1. Single file   If you are resolving conflicts on a single file, the Resolve Version Conflict - <filename> window appears.

      Optionally, click Compare and click Local to Server, Local to Original, or Server to Original to view the file differences side by side in the Difference between <timestamp> and <filename> window.

      Note

      Deleted text is red, changed text is blue, and inserted text is green.

      Once you understand the conflicts between the files, close the Difference between <timestamp> and <filename> window.

      Under Resolution options, select one of the following options:

      Resolution Options

      Description

      Merge changes for me

      Merges the file automatically. This option is disabled if the system detects a conflict.

      Merge changes in merge tool

      Prompts you to determine the changes to accept. If selected, the merge tool appears. Follow the procedure To merge changes in the merge tool below.

      Undo my local changes

      Disregards changes made to the file in your local workspace.

      Discard server changes

      Disregards the server version of the file that conflicts with your local workspace version.

      Click OK.

  4. Repeat the steps until all of the conflicts in the Resolve Conflicts dialog box are resolved, and then click Close.

To merge changes in the merge tool

  1. In the merge tool where the panes display the two files that have areas of conflict highlighted, locate a conflict in the two files by clicking Next Change.

  2. Review the differences between the two file versions and select the change you want to retain in the merge by selecting it.

    The change is placed in the bottom pane.

  3. Repeat the steps until all the conflicts are resolved, and then click OK.

  4. In the Microsoft Visual Studio dialog box, click Yes to save the file.

  5. In the Accept Merged Result dialog box, click Yes to keep the merged file.

See Also

Tasks

How to: Reconcile Differences Between Two Folders

How to: Merge Files and Folders

How to: Get the Source for Your Team Project

Reference

Resolve Command

Pending Checkins Window

Other Resources

Resolving Folder Differences and File Conflicts (Team Foundation Version Control)