“与工作区版本比较”和“与最新版本比较”的区别是什么?

我在 TFS 中使用 VisualStudio2012。 每当我想要比较签出的文件时,我有两个选项可供选择:

  1. 与工作区版本进行比较
  2. 与最新版本比较

screenshot

有什么区别吗?

16078 次浏览

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

  • 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

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

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