FAQ: Branching is easy, but can I merge without branching?

Baseless merging is well documented in the TFS Branching and Merging Guide and MSDN, as are the perils in numerous blog posts. However, often questions pop up such as “Can TFS 2012 perform merges across projects in the same collection?”  … let’s try, whereby this is a “quick and simple” experiment to answer this question and not an exploration of baseless merging.

Experiment 1 – merge between unrelated team projects

  1. Create a team project called Area51.
  2. Create a main folder, create a simple console application, tweak the Area51 code, add the files to version control and check-in.
  3. Create a team project, in the same collection, called Area52, create a main folder, copy the console application into the new folder, add the files to version control and check-in.
  4. Tweak the Area52  code:
  5. Perform a branch from $/Area51/main to $/Area51/dev, then tweak the Area51 code in dev:
  6. Take a deep breath and review our ecosystem, which has two team projects and a variation of the code in three places.
  7. Select $/Area52/main, right-click node in source explorer, select merge and set the target as $/Area51/dev.
    Note that the IDE warns you that it will perform a baseless merge:
  8. If we look at the pending changes we will notice the merge actions:
  9. When we commit the baseless merge, we have changed our ecosystem as follows:

Experiment 2– merge between isolated branches within same team project

How about merging branches without a relationship within a team project?

  1. Branch from $/Area51/main to $/Area51/devAlien, effectively creating two development branches that are isolated from each other.
  2. To merge from dev to main or devAlien to main is natural.
  3. To merge from devAlien to dev invokes the baseless merge again, as the two branches are isolated.
  4. After we go through the merge we can track the associated changesets and visually display the relationship. Note the dashed lines which show baseless merges, whereby I performed one from dev to devAlien and vice versa as part of my experiment.


So, the answer to the “Can TFS 2012 perform merges across projects in the same collection?” question is a YES … followed by a BUT be careful, be very, very careful. I recommend that you review the TFS Branching and Merging Guide and also review perils reported by numerous blog posts, before you try this in your environment.

In the TFS Branching and Merging Guide you will find the following quote: Your branch distance from main is equal to your level of insanity” – anonymous

Now the actual distance between $/Area51/dev and $/Area52/dev is an interesting discussion, but out of scope for this quick experimentation post. I hope that the project lead, Micheal Learned, of the Branching Guide will react to this post and hopefully pickup the discussion around distance and level of insanity Smile

Comments (4)

  1. Sam K says:

    Cool. Can you see history across the team project boundary of the merged files and at the folder level?

  2. willys says:

    Sam, can you elaborate on the changes you would want to make across team project boundaries and what history you would expect to see. What will not work across branches in multiple team projects is branch visualization and track merges change visualization across these boundaries. If you want to use the visualization feature you should avoid cross TP boundary branch/merge adventures.

  3. HerbM_YVR says:

    Is part 1’s step 7’s figure in error (merge from 52’s main into a subfolder of 51’s dev)?

    1. HerbM_YVR, thanks for spotting that error. I removed the subfolder on the image.