Team Foundation Server: File Collisions

When using a DEV and MAIN branch for source code, care must be taken when deleting and recreating files with identical names. For example:

  1. Developer establishes a branch relationship between source and target (tf branch source target)
  2. Normal development continues to happen and files get added and merged between these two trees
  3. Developer deletes a file in source (a.txt)
  4. Developer adds a file in source with that same name (a.txt) at a later time
  5. Developer merges these files using the UI (you can also use the command line- tf merge source target /recursive)
  6. Merge computes and for the file that was deleted and re-added a merge, branch is generated (this is expected)
  7. Developer goes and checks in
  8. Developer gets a conflict

There are a number of “proper” ways to sort this out, but these involve an indepth knowledge of TFS and the command line interface.

An alternative is to do the following in the UI (NOTE: you will lose historic data for the deleted file):

  1. Rename the conflicting file (from a.txt to a.txt.new)
  2. Delete the original file from source control (a.txt)
  3. Check-in changes.
  4. Rename the conflicting file (from a.txt.new to a.txt)
  5. Check-in changes.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

A WordPress.com Website.

Up ↑

%d bloggers like this: