Why "Get Latest" sometimes doesn’t…

I've seen quite a bit of angst from new TFS users over the "Get Latest Version" behavior in Team Foundation Server source code control, so I think it's worth a bit of discussion.

The most common issue people report is that issuing the "Get Latest Version" doesn't actually bring the latest version of the file down from the server when the local copy has been deleted for some reason (intentionally or otherwise). 

It may surprise you at first, but this is actually the intended behavior of TFS!  TFS stores information on the server about which versions you have "gotten" to your local workspace.  We do this to reduce the amount of files you have to copy down when you issue a "get latest" from the top level of your project as most people do.  This speeds up your "get" significantly by only refreshing the items in your workspace that have changed on the server.  Imagine if you had a large project and the server always sent you the latest version of every file even if you had it on your disk already.  You'd be sitting around twiddling your thumbs for a long time while you waited for the server to give you what you already have.  That's not productive, right?  😉

Of course, there are ways to "fool" any system.  In this case, you can fool TFS either by marking a local file as writeable without actually checking it out or by deleting a local copy of a file without pending a "delete" command to TFS.  In both of these cases, the server has no idea that you've modified or deleted your local files.  If doing this on a regular basis is part of your normal workflow, I'd love to hear more details about why you do this.

So how do you really Get Latest?

From the UI (i.e. Solution Explorer or the Source Control Explorer)

1.  Right click on the item(s) you want to get and click Get Specific Version

2.  In the dialog that pops up, check the appropriate checkbox for your situation:

  • If you've marked a local copy writeable without actually checking it out, and if you don't care about losing any changes to the file, check "Overwrite writeable files that are not checked out"
  • If you've deleted a local copy and want to get it back, check "Overwrite all files even if the local version matches the specified version"

Get Specific Version dialog

If these still don't help, post comments here or post questions in the MSDN forums and we'll help you out.

Here are some other discussions of the Get Latest behavior:


Comments (7)

Cancel reply

  1. Willy-Peter Schaub on TFS 2008 Service Pack 1 – Caution with database backups! Jason Barile on Why "Get…

  2. Bertrand says:

    As an additional note, In the latest power tool you can also use the "scorche /deletes" command to synch up quickly.

  3. You’ve been kicked (a good thing) – Trackback from DotNetKicks.com

  4. Henry says:

    I understand the reasoning behind having TFS record my version of the file, but I like the Subversion approach better. It keeps a hidden ‘.svn’ folder that keeps track of this for me. (Also helps in working off-line)

    Subversion also will replace any missing files that I have removed (accidental or other) when I simply get latest, I would not have to get a specific version.

    I am trying to love TFS but it is hard when features I am used to are missing or work differently

  5. Randy Stimpson says:

    TFS may have a faster Get Lastest algorithm but this abnormal behavior has wasted so much of my time that a faster algorithm will never make up for it. The Subversion approach is definitely smarter.

  6. Jason Barile says:

    I love to see the comments, but realize that I don't work on the TFS team anymore, so you're probably better off leaving comments over on BHarry's blog 🙂

  7. Randy Stimpson says:

    The more places I have to complain the better I feel 😉 Luckily this blog entry was here to clarify TFS behavior. Thanks.

Skip to main content