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
- Create a team project called Area51.
- Create a main folder, create a simple console application, tweak the Area51 code, add the files to version control and check-in.
- 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.
- Tweak the Area52 code:
- Perform a branch from $/Area51/main to $/Area51/dev, then tweak the Area51 code in dev:
- Take a deep breath and review our ecosystem, which has two team projects and a variation of the code in three places.
- 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:
- If we look at the pending changes we will notice the merge actions:
- 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?
- Branch from $/Area51/main to $/Area51/devAlien, effectively creating two development branches that are isolated from each other.
- To merge from dev to main or devAlien to main is natural.
- To merge from devAlien to dev invokes the baseless merge again, as the two branches are isolated.
- 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