Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Compare files

You can use the Diff window to clearly see the difference between two files or two versions of the same file. If one of the versions of the file is checked out in your workspace, you can modify the file as you run the comparison. You can also use this window to conduct a code review of some changes to a file.

Required Permissions

You must be one of the Contributors for your team project. See Team Foundation Server default groups, permissions, and roles.

What do you want to do?

You can highlight and more easily examine the work you have done by comparing a file in your workspace with the version you checked out. You can also compare your work with the latest version on your Team Foundation Server, and edit the file while you are comparing it.

  1. If you are not already connected to the team project that you want to work in, then connect to the team project.

  2. Choose Home icon Home, and then choose Pending Changes icon Pending Changes.

  3. On the Pending Changes page, locate the file. Open the shortcut menu for this file, and then:

    • Choose Compare with Workspace Version to see what changes you have made to the version you checked out.

      Tip Tip

      You can also press Ctrl+Shift and then double-click the file.

    • Choose Compare with Latest Version to see how the changes you have made compare to the latest version of the file on your Team Foundation Server.

  4. The Diff window appears. You can continue to make changes to the file in this window.

Tip Tip

You can also use Solution Explorer and the Source Control Explorer windows to compare the file in your workspace with a version of the file on the server. Select a file, open its shortcut menu, and then choose Compare. When the Compare dialog box appears, choose OK.

When you participate in a code review, you use the Diff window to see the code changes that are the subject of the review.

You can compare two versions of a file in the history of that file on your Team Foundation Server.

  1. On the menu bar, choose View, Other Windows, Source Control Explorer.

  2. In Source Control Explorer, open the shortcut menu for the file and then choose View History.

  3. Select two versions of the file, open the shortcut menu, and then choose Compare.

    The Diff window appears.

You can compare any two files. The files can both reside on the local client, both on your Team Foundation Server, or one on each.

  1. On the menu bar, choose View, Other Windows, Source Control Explorer.

  2. In Source Control Explorer, open the shortcut menu for the file and then choose Compare.

    The Compare dialog box appears.

  3. Specify the two files you want to compare - one under Source Path and the other under Target Path:

    • Type a path, or open the Browse menu, choose Local Path or Server Path, and then browse to choose the file.

    • Choose an option from the Type menu: Changeset, Date, Label, Latest Version, or Workspace Version. Use the fields that appear to specify the version.

  4. Choose OK.

Comaring two versions of a file

Comparison window layouts

Step 1 Deleted text

Step 2 Added text

Step 3 Changed text

Step 4 Code review comment

Step 5 Visual summary of the differences between the files

Here are some tips for working with the Diff window:

  • Although Side-by-side mode is generally more effective in most cases, you can use whichever mode works best for you and the code you are examining.

  • To skip:

    • To the next difference, choose Next difference Next difference (Keyboard: F8).

    • To the previous difference, choose Previous difference Previous difference (Keyboard: Shift+F8).

    • Back and forth in the file, choose a section of the Step 5 visual summary.

  • When you participate in a code review, you use the Diff window to see the code changes that are the subject of the review. For more information, see Day in the life of an ALM Developer: Suspend work, fix a bug, and conduct a code review.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft