1

My company has some folders in Azure DevOps Server 2019 (TFVC) where we encounter merge issues. When we try to merge the changes from child folder X of Branch A to child folder X in Branch B, it wants to merge it to child folder Y in Branch B instead. If I merge the branches directly, it uses the correct paths.

In one case I think it is because the original folder was renamed, which actually is a delete+add function, and then the original folder was repurposed for another Visual Studio project. In another I think that someone accidentally attempted to merge to the wrong folder.

Either way, it still leaves me with issues as some users do not notice this when attempting to merge their changes, and they end up merging to the wrong location, causing no end of troubles.

Is there any way that I can break that relationship such that it stops suggesting the incorrect child folder, preferrably without having to scrap the existing branch and potentially loose all our history?

Note that I have tried to look for a way to do this, but have not found anything helpful as yet. Perhaps I am simply searching for the wrong thing. I would even be willing to adjust some things directly in the database, depending on the risk.

Update: The issue I am faced with for some of these is the following:

  1. I cannot rollback the change that created the merge relationship.
  2. Visual Studio's Source Control Merge Wizard seems to default the "Target Branch" folder to the wrong folder when performing a merge directly on a folder instead of at the branch root.
  3. Some users do not notice this, and thus do not select the correct path, and therefore perform an incorrect merge, which then must be corrected when it is eventually detected.

It would be much easier if I could prevent this somehow, which is why I was hoping to break the relationship so Visual Studio would no longer recommend it. This has actually caused files to be removed from Azure DevOps, but thankfully the rollback restores them.

Thank you.

Shaggie
  • 111
  • 1
  • 8

1 Answers1

0

TFVC supports for specific folders and files merging between two branches. If you merged folder x in Branch A to folder y in Branch B incorrectly, you can use tf rollback command to roll back the effects of one or more changeset without losing history.

Please follow below steps:

1 In Visual Studio Source Control Explorer, right-click the branch, folder, or file that you want to merge, and select Branching and Merging > Merge.

You can also select the file and then select File > Source Control > Branching and Merging > Merge.

You can specify folder both in source branch and target branch and it will create a merge relationship from folder x in Branch A to folder x in Branch B

merge

2 use tf merges command to displays detailed information about past merges between the specified source and destination branches. merges

3 use tf rollback to roll back wrong merges. rollback

After rolling back the wrong merge ,the files of folder y in branch B will back to before the merge. Now the folder y in branch B are correct.

4 use tf check in to check in pending changes.

5 return to step 1 and merge folder x in Branch A to folder x in Branch B.

At last ,use tf merges to see the merge lists, you can also see previous merges history without missing.

Dou Xu-MSFT
  • 880
  • 1
  • 1
  • 4
  • I know I can rollback an incorrect merge, and have done that in the past but the original that created the link is so far back in time now I don't think I could do that now. Besides, the rename instance was a desired action, but I no longer want any cross merges. – Shaggie Dec 24 '22 at 03:51
  • In my opinion, the folder x on branch A and the folder x on branch B has no necessary mapping relationship when merge in TFVC. Because you can choose any folder you want to merge, it doesn't make sense to break a merger relationship. I think `rollback` is more suitable way to achieve it. – Dou Xu-MSFT Dec 27 '22 at 01:38
  • I understand what you are saying. The issue I am faced with for some of these is this: 1. I cannot rollback the change that created the merge relationship. 2. It seems to default the target to the wrong folder when starting a merge directly on a folder instead of at the branch root. 3. Some users do not notice this and perform an incorrect merge, which then must be corrected, when it is finally detected. It would be much easier if I could prevent this somehow, which is why I was hoping to break the relationship so Visual Studio would no longer recommend it. – Shaggie Jan 02 '23 at 23:47