1

In my default collection, I have a team project. In that team project, I have 2 branches : PROD and DEV. Lately, I've been working on DEV mainly. So since the number of changesets are common between PROD and DEV, I have the current issue :

One of the file has a changeset number in PROD (2470) is lower than the one in DEV (2539) (from what I can see in the merge tool)

When I did a merge from PROD to DEV, the first time, TFS did not see that the file needed to be merged.

I had a lot of compilation errors. So I had to modify the file in DEV, do a check-in and then, during the merge, TFS saw it and asked me in the resolve conflicts tab to deal with the file.

BUT,

in the merge tool, all the new code in DEV are overwritten by the code in PROD. I don't understand ! For example, the file in DEV has some new using directives. But the merge tool removed them because it's picking the PROD file. So most of the new code is hidden by the lower changeset.

What's going on ? I am afraid to merge or using TFS now !

Did you have a similar problem ? What can I do ?

Added a picture of the source explorer tree : source explorer tree

RNadeau
  • 11
  • 5
  • Another example, if some new code exists in PROD, it's removed from DEV. I added new members in a class in PROD, after a merge, TFS removed them automatically from the merged file like if it taught the members in PROD are old and was removed in DEV. – RNadeau Mar 14 '18 at 19:07
  • 1
    Can you elaborate more on how the branches were created? I assume from your description that PROD is a child of DEV? In that case, if there are changes made in Prod, they would be available to be merged to DEV. – Hamid Shahid Mar 14 '18 at 20:38
  • Did you check in some files during your merge process instead of resolving conflicts? When you merge, did you select the latest version of DEV(after checked in code)? Have you compare the latest DEV with PROD? – PatrickLu-MSFT Mar 15 '18 at 16:04
  • @HamidShahid DEVelopment was made from PRODuction. That's what i've expected too. Changes are detected but it's like TFS think PROD is too old and since there's no conflicts, it removes new code from PROD and merges it in DEV without notices. – RNadeau Mar 15 '18 at 18:31
  • @PatrickLu-MSFT I did not check in some files during the merge process. When I merge, I use the latest version of PROD (I want to merge PROD into DEV). The latest DEV have new features and PROD has also minor bug fixes. – RNadeau Mar 15 '18 at 18:33
  • edited original post to add a picture of the TFS project tree. – RNadeau Mar 15 '18 at 18:37
  • Sorry for the missing comment and later reply, have you ever deleted files in the PROD/DEV branch or rename the PROD branch previously? – PatrickLu-MSFT Apr 03 '18 at 06:37
  • @PatrickLu-MSFT No. But that's not a matter anymore because we switched to another source control. – RNadeau Apr 27 '18 at 17:20

1 Answers1

2

First, please check if there are deleted files in your DEV/Prod branch. To do this go in to "Tools", "options". The expand "Source Control", Select "Visual Studio Team Foundation Server" and check "Show deleted items in the Source Control Explorer"

It's better to undelete the files and folders in the Dev branch, which may prevent "wierd stuff" from happening in the future.

Instead of using the Merge Wizard, you could also use the "tf merge" command.

This will force TFS to merge the changes even if it thinks they've been merged before.

tf merge $/PROD $/DEV /recursive /force

If you are worrying about the merge process in TFS will overwrite your newly features in DEV branch, you could try to add /preview option, this shows a preview of the merge and not actually do the merge. Or use /candidate option, which prints a list of all changesets in the source that have not yet been merged into the destination. The list should include the changeset ID that has not been merged and other basic information about that changeset.

More details please refer this issue: Team Foundation Server merge not merging


If you had ever renamed either your DEV branch or PROD branch, you may met the same issue as this one:TFS Merge Issue with Missing New Files

If all above still not work, suggest you first merge DEV to Prod, this should overwrite the older files in Prod and then merge Prod back to DEV, then the minor bug fixes will also include in DEV branch. This may do the trick, just make sure you have selected appropriate versions when you are solving the conflicts.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62