TFS Source Control Doesn’t Detect Local Changes

There is something you need to be aware of regarding the Get Latest feature in Visual Studio / Team Foundation Server: it doesn't detect local changes

For example, suppose you check a file into source control: 


Then you modify the file without checking it out:



When you return to Source Control Explorer,  it indicates you have the latest version even though the server version doesn't match the local version:



Other source control products such as Source Gear Vault monitor the file system for changes and can detect when a file has been changed locally.  Vault calls a file that has been changed locally a renegade file.



If you work exclusively in Visual Studio and can always check out the files you need to work with, you may never encounter this issue.  If, however, you work disconnected or want to test out something locally without locking files, you need to be aware of how TFS behaves. 


I can't stress the importance of this enough:  If you have local changes, Visual Studio will not pull down the latest copy from source control because it thinks it has the latest version already.  When you try to get the latest version from source control, you'll see this dialog:



When you want a mirror of source control locally, use the "Get Specific Version" feature instead.  Select "Latest Version" as the type, and check the option "Overwrite all files even if the local version matches the specified version":


Comments (5)
  1. Kris says:

    Is there another case where you see "The source files are upto date". I have run into cases where another developer has checked in his source code but when I try to get the latest it does not allow me to do so saying "All files are upto date". It occurs randomly though so I am just wondering if there is another case I should be aware of.

  2. This because of the read-only attribute of a file. TFS Source Control manages checkouts with readonly property.

    But I could not understand that how can you change the text of a file which is readonly?

    If a file is checkedin in source control,in local it is read only…When you change it from local and try to save it it should ask to change the name or location.

  3. johnwpowell says:

    If a file is read-only, you’d have to make it so it’s not read-only before saving it.  You could also overwrite the file by copying, and this is what I do the most.  In the project I’m on, we have a common "bin" directory for shared, pre-built assemblies such as Enterprise Library 3.1.  If I were to copy in EL 4.0 assemblies, overwriting the 3.1 assemblies, I would be working against a different version than everyone else.  If I were to get latest, it wouldn’t get latest unless I use the get specific version feature.

  4. Luke says:

    This annoys the crap out of me too. Its one of the major issues that will prevent adoption by people who don’t spend all day inside Visual Studio. Unfortunately I haven’t seen anything about a fix in 2010 :/

  5. Luke says:

    Oh btw, you can work around this using some command line utilities included in the power tools (tfpt).

    ‘tfpt online’ will check for modifications using an md5 hash and ‘tfpt scorch’ will assist in ensuring source control and your workspace are identical.

Comments are closed.

Skip to main content