Skip to main content

HOW-TO: Apply a “baseless merge” in Team Foundation Server 2010 (and 2012)

Another purely technical post on TFS...

The scenario

We wish to migrate code between branches that do not have a branch/merge relationship, in order to expedite urgent changes being made by a project team, without disrupting on-going BAU development work.

Sample branch hierachy/strategy

Imagine the following branching strategy in TFS (visible by connecting to TFS via Visual Studio 2010 or 2012):

Essentially you have a "DEV" branch, which has a "QA" branch, which in turn has a "PROD" branch. DEV is the branch that you would be using for BAU development. As a piece of development matures, you move it into QA, where it is tested by your internal QA team. There may be further changes made in DEV that are moved into the QA branch as the QA team pick up issues. Once the QA team are happy with a packaged of changes, they will move them into PROD, which is essentially the hand-over to the customer. The PROD branch represents the software that the customer has.

Movement between these branches is "change controlled".

The "DEV-ProjectX" branch, is a branch off of DEV, that is being used to develop a package of work that is independent of BAU work that is going on. Perhaps for example, this represents an urgent or complex change that we do not want to get caught up with day-to-day activities in the codebase.

You can visualise this branching strategy by right clicking DEV and then selecting "View Hierarchy":

Sometimes a picture really can say a thousand words - I find that the visualisation tools provided for TFS by Visual Studio really help.

Our objective

So, imagine that in order to "skip" getting caught up in BAU developments, there is a desire to merge code from the DEV-ProjectX branch directly into the QA branch; this expedites the change and avoids getting it mixed up with other on-going development. To achieve this, we follow these steps:
  • Merge changes from DEV-ProjectX into QA using a “baseless merge”. This is a feature of both TFS 2010 and 2012 where a merge can be made into an unrelated branch. History of both the files/branches being merged are retained, but the files/branches do not have a branch/merge relationship:
  • Once DEV-ProjectX passes QA and is released into PROD, a merge should be performed from QA back into DEV, so that on-going development is integrated with DEV-ProjectX as soon as possible.

Baseless merge in TFS 2010

A baseless merge can be performed on a TFS2010 server, but is not available using the VS2010 UI – it is only available using the command line. In the UI, the only target branch available to be merged into, is the one that the source branch was originally branched from. Note in the following image that when you go to merge the DEV-ProjectX branch using VS2010, the "target branch" DDL only has a single entry in it:

This is what the same popup looks like when you go to merge DEV-ProjectX from VS2012:

You can see that you basically get a browse option for both the source and the target, enabling a baseless merge via the UI.

The UI will advise that you are about to do a baseless merge - it gives a little warning, like this:

Once the baseless merge has been performed, there is a link established between the branches, and subsequent baseless merges can be performed from VS2010 (the branch will appear as being available for merging into in the VS2010 DDL).

Visualising the merge

Once you have "checked in" your changes, a neat feature of VS2010 and VS2012 is the ability to visualise the changeset histories. We can even visualise the baseless merge. Right click and "View History" of the branch, and select the event associated with the baseless merge, the follow these steps to get a neat visualisastion of the baseless merge - select the baseless merged changeset and hit "Track Changeset":

Select the associated branches in the "Track Changeset" screen to show all relevant branches:

Hit the "Visualise" button" - the baseless merge is represented by the dashed line:

To get a view of the timeline of the change, hit the "Timeline Tracking" view at the top of the screen:


This approach may be useful if you have not fully migrated to VS2012 yet and want to perform these type of merges without having to use the command line.

Also note that as mentioned earlier, a baseless merge can be in TFS 2010 using the command line - but since VS2012 is available now, I haven't covered that here. 

And finally, (if you are using a branching strategy like the one described above you will already know this I guess) it's worth noting that when making changes QA/PROD branches prior to making them in DEV, those changes should be merged back down into DEV as soon as possible in order to avoid messy business later on.


Popular posts from this blog

HOW-TO: Add/edit a field in Team Foundation Server 2012 using Visual Studio 2012

It's been a while since I made a purely technical post...

So, today I wanted to make a change to a Microsoft Team Foundation Server 2012 (TFS2012) instance that I am working with to reflect "Actual" time spent on a task - mainly for reporting purposes, and because I have found in the past that making this minor process adjustment yields a relatively useful metric over the long-term.

I am using the Microsoft Scrum 2.1 Process Template ( for a project that I am working with. So that I don't forget how to do this (again!) I will blog-post the procedure I've used to add this field to the template as a screen-shot-based tutorial, as follows...
Before Assuming you are familiar with the Scrum Process Template (2.1-ish) - open a task and take a look at the "Details" section, as follows:

 This is where I want my "Actual" field to show up.
Get the Power Tools Download and install the latest v…

Eclipse/Android error: "Multiple dex files define [...]"

Wow, I am really going nuts blogging this-evening - 2nd post in less than an hour. 

Anyway this is a particularly nasty error that I keep running into with Eclipse/Android when starting the emulator after I have not run it for a little while. Since I run the risk of permanently forgetting the solution to the problem every time I walk away from my Android project (and thus having to spend a painful hour-or-so digging up the procedure again), I will blog it here, for my benefit, and for the benefit of anyone who may also suffer the same problem.

The gist is that when you start the emulator in debug mode (that is, you hit the button in the following image), you get the following error message come out on the console and a nasty popup telling you nothing more than there is an error with your program and you need to fix it:

[2012-04-06 23:20:57 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/google/gson/ExclusionStrategy;
[2012-04-06 23:20:57 - SimpleList] Conversion to Dal…