Samy S.Rathore
Samy S.Rathore

Reputation: 1823

TFS Merging Issue with child branch after rollback

I have a troubling issue with TFS merging between two branches of my project. Let me try to explain the problem.

  1. I have a root branch X
  2. I worked on some feature F1 and commited some code to it say C1
  3. I recieved a request for another Feature F2 which will be developed in parellel to F1 by another team.
  4. I create a child branch of R by the name of Y
  5. I rolled back commit C1 from branch X
  6. I created yet another branch from X, lets say Z where F2 is being developed.
  7. I go on to develop F1 on branch Y and commit some more code to it.
  8. Meanwhile F2 is finished and tested on branch Z. We merge F2 from branch Z to branch X.
  9. Now F1 has also been tested and is stable. It has to be merged back to Branch X

To do that, I have to first merge X into Y to sync F2 code and then I will have to merge F1 in branch Y back into branch X

But every time I attempt do so, TFS rolls back the changes of commit C1 (Deletes new files added in C1 and undo code in edited files) without even giving me a chance to resolve the conflicts.

I even tried to merge X to Y and manually resolved all the conflicts which took me nearly 2-3 hours as there are many files involved. But this is happening again when I'm merging back Y to X. I've been going round and round on this issue for a while now.

Is there a way I can resolve this more easily? Thanks

Upvotes: 0

Views: 393

Answers (1)

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51073

This looks like you didn't use the /keepmergehistory option when you are doing the roll back.

tf rollback /keepmergehistory

This option has an effect only if one or more of the changesets that you are rolling back include a branch or merge change. Specify this option if you want future merges between the same source and the same target to exclude the changes that you are rolling back.

Source Link

You could take a look at the answer from Isaiah4110 with detail explanation in this question TFS merge doesn't pick up rollback changeset(s)

For now you could use cherry pick merge each of the changesets as a workaround like jessehouwing suggested.

Upvotes: 2

Related Questions