98

I see a file in pending changes window. I try to compare it with latest version and I get an a message 'The files are identical' If the files are identical why is this file showing up in pending changes window? What changed about this file? Can I configure TFS not to list files that are identical?

dev.e.loper
  • 35,446
  • 76
  • 161
  • 247
  • Perchance is your anti-virus updating the files' last modified date? Or you're working on an encrypted laptop? – DOK Nov 04 '11 at 16:05
  • ScottGu explains how antivirus can change these dates waaay down in this article (search for "virus") http://weblogs.asp.net/scottgu/archive/2006/09/22/Tip_2F00_Trick_3A00_-Optimizing-ASP.NET-2.0-Web-Project-Build-Performance-with-VS-2005.aspx – DOK Nov 04 '11 at 16:14
  • 61
    This has to be one of THE most annoying TFS "features" – Bradley Thomas Jan 29 '13 at 19:03
  • I'm having this issue too -- TF works, but TFPT doesn't -- I think it's because I'm using "TFPT - Team Foundation Power Tools 2012" with Visual Studio 2010 workspace... :-/ – BrainSlugs83 Dec 23 '13 at 20:46
  • Looks like all I had to do was *connect* to the same collection in Visual Studio 2012. See this post for more details: http://stackoverflow.com/questions/1758606/how-does-tfpt-exe-find-what-workspace-to-work-in – BrainSlugs83 Dec 23 '13 at 21:08
  • I had this same issue in VS2015. As of VS2015 Update 2, there is the ability to "Stage"/"Unstage" changes *(I'm now on Update 3, but I'm sure it's from Update 2)*. For me, right-clicking the "rogue" file(s) and choosing "Stage" then made TFS realise that there were really no changes and remove them from the list of changed files. – Geoff James Aug 24 '16 at 09:40
  • How do you get a message that says 'The files are identical'? It just shows me the files side by side with no differences, but I don't see any messages about it. – Kyle Delaney Sep 19 '17 at 21:32
  • This extension can fix it for VS2017 https://marketplace.visualstudio.com/items?itemName=HolanJan.TFSSourceControlExplorerExtension-18397 – Per G Nov 13 '17 at 06:00

6 Answers6

49

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

enablor
  • 982
  • 9
  • 6
  • 13
    I strongly recommend that you use the `tfpt uu` power tool and **not** the hacky "No To All" solution. Only adds and modified edits get this prompt. For example: renames (that are only pended rename, not rename+edit) will be undone by the UI without prompt. – Edward Thomson Nov 04 '11 at 19:07
  • 8
    In case the original blog post ever goes away, the command is `tfpt uu /noget /r *`, which must be executed from the root of the branch. Saying this, although it correctly picks up redundant changes, then claims to undo them, I still see them as checked out in VS and in the Check In dialog, so it seems broken for me :/ – Mike Chamberlain Jan 17 '13 at 06:14
  • 2
    Another possibility of this happening is if you toggle the "read only" bit of a file without actually changing it's content. TFS can be annoying at times. – arviman Jan 31 '14 at 15:59
  • 2
    For reference, the "No To All" solution is copied here from the link: "Another option is to “Undo Checkout” all the changes, and clicking “No to All” when asked to confirm for undo checkout. This way Visual Studio will “undo checkout” all the files that are not changed, and all the changed files will remain checked out. I always use this method." – PJSimon Aug 25 '15 at 17:37
  • That "No To All" trick is nice, but it has a few drawbacks. For example - I use my tool, to generate DB EntityFramework classes. I generate them in an outside directory, and then just drag them in my solution. Sometimes, when there are no changes, it still displays changes. This "No To All" trick removes them. But if there are new classes added, that were not there before, it removes them from source control - I have to add them back with hand. – Wish Aug 22 '16 at 06:54
  • Installed power tools from `https://marketplace.visualstudio.com/items?itemName=TFSPowerToolsTeam.MicrosoftVisualStudioTeamFoundationServer2015Power` executed `tfpt uu /noget /r *` a lot of changes were reverted. Confirmed. And finally in Pending Changes still show not modified files as changed. – mihkov Apr 21 '17 at 14:33
17

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!

KurzedMetal
  • 12,540
  • 6
  • 39
  • 65
zmaggie
  • 264
  • 1
  • 3
  • 7
  • 2
    I have run "tfpt uu . /noget /recursive", and it claims there are no redundant pending changes in the workspace. VS2015, TFPT 2015. All of my changes are empty [merge] changes. – fastmultiplication Apr 13 '16 at 01:12
  • I had tried this with no success. Removing the point of the argument seems to make it work properly: **uu /noget /recursive** – dperez Feb 08 '17 at 19:45
10

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

Phil
  • 1,062
  • 1
  • 17
  • 15
  • Thanks me-from-november-30th-2015. I keep getting the same issue time and time again and your answer was perfect. I tried to up vote you, but got some kind of 'space-time continuum' error. Something to do with November 30th 1955 and "required 1.21 gigawatts not found". – Phil May 24 '16 at 09:22
  • Unfortunately not working for me. `Unable to determine the workspace`. Already tried updating the workspace cache, no success. After 2 hours I'll just give up and check in the not changed files to get rid of them. – C4d Dec 13 '16 at 09:47
  • @C4u I may have started experiencing that one myself, since moving to VS 2015. However, the issue with checked-out files occurring has gone away. I'll see what I can find out. – Phil Mar 07 '17 at 11:44
  • 1
    I was not able to find the PowerTools using NuGet, but was able to find and install it via a google search "Microsoft Visual Studio Team Foundation Server 2013 Power Tools" – Colin Mar 01 '19 at 16:54
  • @Versatile Looking at Visual Studio 2017, you would need to go to 'Tools' > 'Extensions and Updates...' I don't remember the menu structure in 2013/15. Maybe my answer requires correction. If you have VS 2013/15 and can check the menu structure, please feel free to do an edit on my answer. :) – Phil Mar 05 '19 at 09:28
  • It seems it will not work for VS2019. Currently there is no power tools for VS 2019. – Alex Blokha Jan 07 '22 at 01:04
1

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.

Tom 'Blue' Piddock
  • 2,131
  • 1
  • 21
  • 36
0

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.

Rolf Kristensen
  • 17,785
  • 1
  • 51
  • 70
  • My workspace is local, but the unchaged files still appear in pending changes... It doesn't automatically undo the check-out... – Ozkan Sep 29 '16 at 10:35
0

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