Reparenting a child branch to its grand-parent

user1601700 picture user1601700 · Mar 23, 2014 · Viewed 8.5k times · Source

I have the following branch structure:

- Main
   |- Release 1
      |- Release 1.1
   |- Release 2

I want to reparent Release 1.1 to Main so it looks like

- Main
   |- Release 1
   |- Release 1.1
   |- Release 2

The reason I want to do this is because many changesets will need to be merged from Main to Release 1.1 but not to Release 1

I have been trying to do a baseless merge from Main to Release 1.1 using the following command:

tf merge /recursive /baseless $/Main $/Releases/Release1.1

It works great, once it is checked in, I can reparent Release 1.1 to Main.

But the thing is, this command merges everything from Main and I just want to create a merge relationship. I don't want to merge everything from Main to Release 1.1 since many other changes for other branches have occurred meanwhile.

Is there a way to achieve that or will all the future changesets need to be baseless merged every single time?

Answer

PhilDulac picture PhilDulac · Jun 21, 2016

Based on James Reed comment, the cleanest way to create a merge relationship between the two branches is to simply remove the /recursive parameter:

tf merge /baseless $/Main $/Releases/Release1.1

The merge will then only contain the targeted branch root folder, which you can check in without any other change, without having to cherry pick change sets.