What is the difference between "Compare with Workspace version" and "Compare with Latest version"?

Visual StudioVisual Studio-2012Version ControlTfs

Visual Studio Problem Overview


I am using Visual Studio 2012 with TFS. Whenever I want to compare my checked out files, I have two options to choose from:

  1. Compare with workspace version
  2. Compare with latest version

screenshot

What is the difference ?

Visual Studio Solutions


Solution 1 - Visual Studio

Compare with Latest version seems clear. It compares files against the latest version in TFS. So you'll get all the differences between the very latest version checked into source control and whichever folder you're comparing against.

Compare with Workspace version might be confusing, but is actually pretty simple. TFS keeps track of the version of the file which you've retrieved into your workspace. This is usually the latest version, or pretty close to that, but that doesn't have to be the case.

When using the Get Specific Version option you can retrieve any version of a file to your local workspace. You can even retrieve files from different versions into your workspace. When you select this option, a comparison will be done against the version that is currently in your workspace.

Compare screen

Solution 2 - Visual Studio

  • Comparing with workspace version actually compares the edited file with the version of file at the time you checked out (compares exclusively your changes).

  • Comparing with latest version compares the edited file with latest version of file present at your code repository i.e. it might include changes made by your colleagues.

http://codereferences.blogspot.ca/2012/03/tfs-compare-with-workspace-version.html

Solution 3 - Visual Studio

@serhio's 3/28/14 answer is an excellent narrative answer. However, I'm sure many (including myself) needs that backed-up with an example, and here it is:

  1. For everyone, "Lastest Version" = Changeset # 1.
  2. You "Get Latest".
  3. For you, "Workspace Version" = Changeset # 1.
  4. You make changes.
  5. Developer B "Get Latest".
  6. For Developer B, "Workspace Version" also = Changeset # 1.
  7. Developer B makes changes.
  8. Developer B "Check-in".
  9. For everyone, "Lastest Version" = Changeset # 2.
  10. For Developer B, "Workspace Version" = Changeset # 2.
  11. For you, "Workspace Version" still = Changeset # 1.
  12. You "Get Latest", "Merge Conflicts" (if necessary) and "Check-in".
  13. For everyone, "Lastest Version" = Changeset # 3.
  14. For you, "Workspace Version" = Changeset # 3.
  15. For Developer B, "Workspace Version" still = Changeset # 2.

Solution 4 - Visual Studio

To restate the Answer:

The local file is always the one you are working on.

The server file can either be:

  1. The latest version including all other check-ins. (You see your changes, as well as other peoples changes.)

  2. The Version as it was when you checked it out (You see only your changes, even if other people have checked in since).

If no other people check in files since your checkout, then the both of the above produce exactly the same result.

So if you want to compare what you have done against what it was when you started, select Workspace Version

If you want to compare what you have done against what other people have done, select Latest Version

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBilal FazlaniView Question on Stackoverflow
Solution 1 - Visual StudiojessehouwingView Answer on Stackoverflow
Solution 2 - Visual StudioserhioView Answer on Stackoverflow
Solution 3 - Visual StudioTomView Answer on Stackoverflow
Solution 4 - Visual StudioGreg GumView Answer on Stackoverflow