Say I have branch A in TFS from which I take branch B. Some changesets are made on B, then from B, branch C is taken, and more changes are made on branch C
A ------------------------------
|
B ----1--2------------------
|
C ----3-----4---
Now suppose we want to merge from C into A, but bypassing B. TFS won’t allow this – I have to do a baseless merge, which can be very error prone. Really, I want to get C “reparented” (if that is the correct terminology) so it is a child of A, not B. In other words, I want to end up with the following branch structure. (C’ can either be the original C branch, or a new branch that is what C should have been).
A ------------------------------
| |
B | ----1--2------------------
|
C' |-------1--2----3-----4---
Now C’ can be merged correctly into A without going into B.
My question is, is there any automated tool / script that could set up the pending changes required to create the C’ branch, as to manually do this would take us a very long time?
Reparenting a branch in TFS is hard. You can effectively give it an additional parent via baseless merge, but:
What you seem to be asking for — and I agree is the best solution — is a brand new branch named C’ that happens to have the same contents that C does today. Here’s a quick way to achieve that:
The only disadvantage of this method is that you won’t see changes 3 & 4 in the history. They’ll still be under C_old, of course, but tools like Annotate won’t know that — they’ll see those changes as occurring all at once, on the date you created C’, without the individual comments/work items/etc.