Force comparison of files when merging in Visual S

2019-05-06 19:35发布

Currently when I right-click -> Merge on a specific file in Visual Studio 2008 it attempts (and often succeeds) to automatically merge the file to my indicated target.

How can I force VS to always allow me to manually compare and merge the file in my merge tool?

I should mention that my source control is TFS.

2条回答
We Are One
2楼-- · 2019-05-06 20:02

Try using the command line with the /conservative flag. It is more likely to allow you to merge your changes in the merge tool.

/conservative -> Results in more conflicts when you merge one branch to another.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-05-06 20:24

There are really two potential issues here:

  1. As part of the Merge calculation, the server determines that no changes have been committed against the target file since the last time the two were fully in sync. Therefore, it's safe (by TFS semantics anyway) to simply overwrite the target file.

  2. There are history records in both branches, so the server declares the file to be in a conflict state. It's now up to the client to choose a resolution.

    • You can decide to keep either the source or the target as-is.
    • You can opt for a manual merge in your configured tool.
    • You can request an AutoMerge (via tf resolve -auto:acceptmerge, or the Auto Merge All button on the outer dialog, or the "merge changes for me" radio button on the inner dialog)
      • If the AutoMerge fails, you'll be presented with the same choices except that AutoMerge will be greyed out

There is nothing you can do about situation #1. It really should be safe unless there is a serious unpatched defect in the server code, corruption in the history database, or [most likely] your previous resolution choices have dramatically misled TFS about your true intentions. Worst case scenario, you always have the chance to build & run tests against your pending merge before anything gets checked in.

As you can see, there are many wrinkles to situation #2. It's unclear which step of that process you want to interdict, if any. Good news is, once control is transferred to the client, you have a broad (and easily extended) range of choices. Only tricky part is making sure you understand the consequences of each; admittedly, neither the UI nor the documentation is completely clear on this count. Reply with more details of your issue as needed.

查看更多
登录 后发表回答