Udostępnij za pośrednictwem


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: 

8    

Then you modify the file without checking it out:

3 

 

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:

8 

 

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.

SourceGear 

 

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:

5

 

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

6

Comments

  • Anonymous
    May 21, 2008
    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.

  • Anonymous
    May 21, 2008
    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.

  • Anonymous
    May 22, 2008
    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.

  • Anonymous
    August 06, 2009
    The comment has been removed

  • Anonymous
    August 06, 2009
    The comment has been removed