Austin Agile DevOps

DevOps in the Cloud
posts - 70 , comments - 7 , trackbacks - 0

TFS Branch/Merge and Workspaces

I recently responded to concerns about TFS branching where "...when I delete files from my local workspace..." was part of the situation.

More than once since 2005 I've had developers come to me, red faced and exasperated because TFS was "using" incorrect versions of their files even though they had performed Get Latest. Without exception I found that they had also been moving, renaming or and deleting files in the local workspace via the file system.

My advice then and now is to consider how Microsoft intends workspaces to be used and used specifically with respect to branching and merging, though I can’t speak for Microsoft, but rather of my own experience.

  1. TFS expects the workspace to always contain the version of files that you want to be working with. In other words, if your workspace doesn’t contain the correct version, then you need to address that before you do any branch/merge. The typical workspace state that I consider “valid” is where all local files are at the latest version or at some specified prior version.”
  2. A workspace would be "invalid" when files have been moved, renamed or deleted from the local mapping. This should never be done unless as a step immediately prior to re-syncing from TFS
  3. It is possible to branch and merge with an empty workspace, but the intent is to allow branch or merge without having to download the files to the workspace. My suggested guideline is that this be used by experts who explicitly understand how to create and ensure an empty, though mapped, workspace.

The main point that users need to understand is that TFS assumes it is in-sync with the local mapping (for latest or for a specified version).

As regarding practices:

  • Don’t always use Get Specific Version with overwrite as a general practice. The general practice should be never to delete or rename files in the local mapping; always move, rename and delete files from TFS (the Source Control Explorer). When users follow this practice the Get Latest feature works nicely.
  • Doing branch/merge from a populated workspace is the “expected” or “natural” practice. Another way to understand this is to see the Source Control Explorer, not the local directories, as the “window” into your files.

There are certainly other approaches that may work better depending on the situation. I can say that these practices have worked well for me over the past several years.

Print | posted on Friday, July 9, 2010 2:02 PM | Filed Under [ Agile SCM Talk Blog ]


No comments posted yet.
Post A Comment

Powered by: