Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Remove a Branch from the Middle of the Hierarchy?

Tags:

branch

tfs

I have a Team Project created with the "Standard" branch pattern from the ALM Rangers' Branching guidance:

Standard Branch Hierarchy

After creating it, I found that I only really needed the "Basic" pattern. That is, I don't need the "Service Pack" branch.

Is there a way for me to remove the "Service Pack" branch and "heal" the hierarchy so that "Release" is under "Main" in the hierarchy? Right now, every changeset in the "Service Pack" hierarchy has a corresponding changeset in the "Release" hierarchy, as "Service Pack" has just been in the way.

like image 526
John Saunders Avatar asked Oct 20 '11 02:10

John Saunders


1 Answers

Branches in TFS are unfortunately old-fashioned (or, "Dinosaur-like" if you ask Torvalds ;) in that once created, the structure is set and cannot be changed. I believe you will have to create a new Release Branch directly below the Main, and then perform a baseless merge from the old Release branch to the new. I think you should use the /noprompt parameter to the merge command to stop the "Resolve Conflicts" dialog to show.

This will give you more conflicts than really needed, since TFS won't know what ancestor to use. But since you will want to take all from the original Release branch, you can use the command tf resolve /recursive /auto:TakeTheirs to tell TFS to always take the changes in the source branch.

After that, you should be able to remove the old branch tree.

Complicated, but not impossible.

like image 182
Torbjörn Bergstedt Avatar answered Sep 22 '22 13:09

Torbjörn Bergstedt