Team Foundation Server merge not merging

2019-06-21 07:41发布

问题:

Why does TFS not want to give me my old files back?

Dev Branch

Main Branch

Merging Dev to Main

Edit: Given the first answer below and some more investigation, I believe I am trying to accomplish an entire branch overwrite. Is this possible?

回答1:

This is a good one, I think the best thing to do would be to undelete the files and folders in the Main 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"

This will allow you to select the deleted files and use the "undelete" command to get them back.

However if you really want to push the changes from your dev branch to the main branch then you might be able to use the command line to force TFS to do the merge.

Open a Visual Studio 2010 command prompt and navigate to your workspace

e.g. cd c:\tfs\MyLocalWorkspace

Then use the "tf" command

tf merge $/TeamProject/Dev $/TeamProject/Main /recursive /force

This will force TFS to merge the changes even if it thinks they've been merged before. I would probably say that using "undelete" is the least likely method to cause "wierd stuff" from happening in the future.



回答2:

If you've deleted the files in Main branch (not clear from question but somewhat implied by "old files back"), doing a merge from a branch where the files were not deleted will not bring them back. It would look at the delete as a change missing from the Dev branch, and so keep it in the merged result.

If you want to undelete the files, why don't you just do that in the main branch?