Dela via


Resolve Conflicts between Two Files

An advantage of using Team Foundation version control to manage your files is that multiple people can work concurrently on an asset such as a source-code file. However, allowing work to occur concurrently on the same file means that sometimes you will have to resolve conflicts.

When you try to perform any of the following operations, a conflict can occur:

  • Get or check in a file, a conflict can occur between the version in your workspace and the version on the server.

  • Merge from one branch to another, a conflict can occur between the version of the file in the source branch and the version of the file in the target branch.

  • Perform a roll back operation using the tf rollback command, a conflict can occur between the current version of the file and the version that you are trying to create.

While it can be frustrating to encounter conflicts when you are trying to complete an operation, Team Foundation version control provides you with information to help you understand the cause of the conflict, and tools that you can use to resolve the conflict. In many cases, you can use automatic operations such as AutoResolve All or AutoMerge to quickly resolve one or more conflicts.

In this Article

  • Manage which Conflicts Are Displayed

  • Get More Information about a Conflict

  • Resolve Conflicts

Required Permissions

To perform these procedures, you must have the Read permission for the item in the source path and Check out permission for the item in the target path set to Allow. If you are renaming the item in the target path, you must have the Check out permission for both the source path and the target path 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.

Manage which Conflicts Are Displayed

The Conflicts channel of the Pending Changes window appears automatically when an operation you are attempting to perform is blocked by one or more conflicts. By default, the window shows only the conflicts caused by the most recent operation you attempted. When the window is in this state, a message appears that begins: Path filter applied

However, you can make the window display all conflicts that are blocking all pending changes in your workspace by performing the following steps:

To show all conflicts in your workspace

  1. If the Pending Changes window is not already displayed, click the View menu, point to Other Windows, and then click Pending Changes.

  2. Click ms181433.VCtrl_PendChgsConflictsButton(en-us,VS.100).png Conflicts.

  3. Click Get All Conflicts.

    After you click this button, the message displayed begins: n Total Conflicts….

If a lot of time has passed since you made changes to files in your workspace, new conflicts may have occurred during that time. You can refresh the Pending Changes window to show these conflicts by performing the following steps:

To refresh the pending changes window

  1. If the Pending Changes window is not already displayed, click the View menu, point to Other Windows, and then click Pending Changes.

  2. Click ms181433.VCtrl_PendChgsConflictsButton(en-us,VS.100).png Conflicts.

  3. Click Refresh.

Get More Information about a Conflict

Before you can attempt to resolve a conflict, you may need to get more information about the changes made to the file that are causing the conflict.

To get more information about a conflict

  1. Display the Conflicts channel of the Pending Changes window (for more information, see Manage which Conflicts Are Displayed.)

  2. Locate and select the conflict that you want to research

  3. Read the information that is displayed in the selected conflict. For some types of conflicts, links are displayed that you can click to get additional information.

  4. (Optional) Perform one of the following steps:

    • Click History button History to see the history of the file. If the operation that caused the conflict is a Merge or a Rollback, then you can click the menu control to the right of History and then select either Source History or Target History.

    • Click Annotate button Annotate to view details on all changes that were made to the most recent version of the file, including who made each change and when they made it.

    • Click the menu control to the right of Compare File button Compare and select a command.

      If you are trying to…

      Then select…

      In order to…

      Check in or get a file

      Compare Local to Server

      Compare the copy in your workspace to the latest version on the server.

      Compare Local to Original

      Compare the copy in your workspace to the version on the server that is checked out to you.

      Compare Server to Original

      Compare the latest version on the server to the version checked out to you.

      Merge a file

      Compare Source to Target

      Compare the version in the source of the merge to the version in the target of the merge.

      Compare Source to Base

      Compare the version in the source of the merge to the last version when a merge occurred between the source and the target.

      Compare Target to Base

      Compare the version in the target of the merge to the last version when a merge occurred between the source and the target.

      Roll back a file

      Compare Source to Target

      Compare the version of the file that most immediately precedes the versions that you are eliminating (the source) with the rolled back version of the file (the target) in your workspace.

      Compare Source to Base

      Compare the version of the file that most immediately precedes the versions that you are eliminating (the source) with the version of the file that contains the changes you are eliminating (the base).

      Compare Target to Base

      Compare the rolled back version of the file (the target) in your workspace with the version of the file that contains the changes that you are eliminating (the base).

Resolve Conflicts

Team Foundation version control has several tools that you can use to resolve conflicts that are blocking operations that you are trying to perform.

To select a method to resolve conflicts

  • Review the following table and click the method that you want to use.

    Resolution Methods

    Description

    AutoResolve All Conflicts

    The system attempts to resolve all the conflicts. You can choose to exclude some of the heuristics used by the system.

    AutoMerge an Individual Conflict

    System attempts to resolve one conflict. You do not have the option to exclude any of the heuristics used by the system.

    Manually Resolve an Individual Conflict

    You manually select an action to resolve the conflict.

To AutoResolve All conflicts

  1. Display the Conflicts channel of the Pending Changes window (for more information, see Manage which Conflicts Are Displayed.)

  2. Click AutoResolve All, and then select one of the following options:

    • Select All Conflict Types if you want the system to attempt to resolve the conflicts automatically by using all its heuristics.

    • Select Specific Conflict Types if you want the system to attempt to resolve the conflicts, but you want to exclude some heuristics.

      The Choose Conflicts to Resolve dialog box appears. Check or clear the heuristics that you want to enable or disable, and then click AutoMerge. For more information, see Specify AutoResolve Resolution Options.

  3. The system attempts to automatically resolve the conflicts displayed in the Pending Changes window. Any conflicts the system was unable to resolve will remain in the window; these are conflicts that must be manually resolved.

To AutoMerge a single conflict

  1. Display the Conflicts channel of the Pending Changes window (for more information, see Manage which Conflicts Are Displayed.)

  2. Locate and select the conflict that you want to resolve.

    Tip

    You can press and hold the CONTROL or SHIFT keys and then select multiple conflicts.

  3. Click AutoMerge.

Note

If AutoMerge is disabled, then this conflict must be manually resolved.

To manually resolve a single conflict

  1. Display the Conflicts channel of the Pending Changes window (for more information, see Manage which Conflicts Are Displayed.)

  2. Locate and select the conflict that you want to resolve.

    Tip

    You can press and hold the CONTROL or SHIFT keys and then select multiple conflicts.

    Within the selected conflicts, the system displays the actions that you can take to resolve the conflict. The actions displayed depend upon the conflict type, and the operation that caused the conflict.

  3. Select an action to resolve the conflict.

See Also

Tasks

Reconcile Differences Between Two Folders

Merge Folders and Files

Merge Folders and Files

Reference

Resolve Command

Concepts

Submitting Changes

Pending Changes

Other Resources

Resolving Folder Differences and File Conflicts

Get the Source for Your Team Project

Get the Source for Your Team Project