TFS baseless merge

I am a software developer and my day-to-day tasks involve among others implementing new features, fixing bugs, creating tests to verify that the production code works as expected, doing clarifications and last but not least writing technical documents.

Additionally I am sometimes responsible for a development branch and I get to do the forward and reverse integration, taking care of the build definitions and all the other usual branch master tasks that go with it. I am always happy to learn new things and this is also one of them. By being a branch master I have the opportunity to get to know parts of our application and of our code that I don’t work with every day.

I was recently faced with the challenge to move the prototype implementation to my branch so that we, the developers, can start extending the prototype and build it into a final feature. We could not use the usual reverse and forward integration merge because there was no parent-child relationship between the source and target branches so we had no choice but to perform a baseless merge.

I was among the first in the team having to do a baseless merge and so I had to do my research first. I have found a great article on MSDN on how to do a baseless merge using the tf merge command:

How To: Perform a Baseless Merge in Visual Studio Team Foundation Server

We ended up using a different approach but it was equally effective:

  • Map both branches locally in workspaces (both workspaces contain the latest version),
  • Copy the source branch files over to the target branch, e.g. in Windows Explorer (if changes were made only in specific folder(s) on the source branch, then copying just the folder(s) is enough),
  • Check out the entire target branch workspace or the specific folder(s) on the target branch in TFS (note that only the affected files containing actual differences will be displayed in the Pending Changes)
  • Resolve the conflicts and check in the changes

We used this technique twice so far successfully.

Note that with this approach the history of the source branch is lost so the first entry in the target branch’s history will be the changeset with the baseless merge.