VisualStudioTFS 在挂起的更改列表中显示未更改的文件

我在挂起的更改窗口中看到一个文件。我尝试将它与最新的版本进行比较,我得到一个消息“文件是相同的”如果文件是相同的,为什么这个文件显示在挂起的更改窗口?这个文件怎么变了?我可以配置 TFS 不列出相同的文件吗?

32250 次浏览

This is normal if a file becomes automatically checked out due to a change, and if ultimately the contents of the file are changed back to it's original state. At that point you would see the message about identical contents upon comparison.

This blog entry describes a not-so intuitive way of dealing with this; and in the comments there is an even better suggestion on dealing with it through the command line via TFS power tools.

TFS pending changes ignoring identical files...

Recently I just updated VS2010 to VS 2013, and this issue even worse. When you use compare, files that are identical don't pop up at all. I hate this because you could not figure out which files are truly changed until you check the compare files carefully.

Finally I figure out a workaround for this:
Add "Undo unchanged checkouts" in the external tools:

  • Command: tfpt.exe
  • Arguments: uu . /noget /recursive
  • Initial directory: $(SolutionDir)

After running this command, TFS will automatically undo all the redundant changes in the files.
But these files still keep check out status, actually they are already undo and same as the latest version. I think It is a bug in TFS. You just need click Refresh icon in the toolbar under solution explorer, these files will be refreshed and show the correct status!

To make the above explanation clearer:

  1. Install TFS Power Tools using the NuGet package manager in VS.
  2. Open the Visual Studio Command Prompt (also called Developer Command Prompt for VS 2013/2015) from Windows Start.
  3. Navigate to the root location of your local workspace through the command prompt.
  4. Execute this command: tfpt uu . /recursive /noget
  5. Choose to discard redundant changes if prompted.

Worked for me.

Further:

Sometimes I have found I need to run the command on the opening prompt of the Developer Command Prompt (and getting a workspace not found error), before navigating to the workspace folder and executing there. If I go straight to the correct folder, the command is not found. (I wouldn't mind a solution to that issue in itself.)

Visual Studio 2012 introduced a new concept called Local Workspace.

When the Workspace Location is configured to be Local, then it will place a local copy of the original file (Just like SVN / CVS).

It will then automatically hide unchanged files from pending changes.

Use the TFS Source Control Explorer to "Edit..." the TFS Workspace, and change the "Advanced..."-setting Location from Server to Local.

I solved this by clicking the Stage All button in Changes then unstaging them with Unstage All.

It resolved the unchanged file I had in my Changes section. Nice and simple.

For me, reconciling the workspace resolves these invalid pending changes:

  1. Team Explorer -> Builds
  2. Right click on latest build with you changes -> "Reconcile Workspace..."