Question: How do I resolve conflicts manually?

- J.D. Meier, Jason Taylor, Alex Mackman, Prashant Bansode

Answer

To resolve merge conflicts, use the Visual Studio merge tool. If a conflict is detected during a merge, you can resolve the conflict either automatically or manually. If you choose to resolve the conflict manually, you can keep the source changes, keep the target changes, or resolve the conflict in the merge tool.

You might need to resolve conflicts when merging changes between branches, getting files into your workspace, or checking in new versions of files. There are three conflict types:
  • Version – The file has evolved along divergent paths. This could be the result of a file edit, rename, delete, or undelete.
  • File name collision – Two or more items are trying to occupy the same path.
  • Local overwrite – Only occurs during a get operation, if you are trying to overwrite a local, editable file.

Most conflicts can be resolved automatically; version conflicts are the only conflict type that might result in a manual merge operation. Manual merge is most common in the following scenarios:
  • A file has been edited in both branches, with changes to the same lines of code.
  • A baseless merge is being conducted in which the branch file relationships are not known to TFS.

The merge tool shows you the details for each conflict and allows you to choose which change you want to keep in the final merged file. You can choose to keep the source change, keep the destination change, integrate both changes, or manually modify the final version by typing directly into the file.

After resolving every conflict in the file, save the final version as a pending change to be checked into the target branch.

Be careful when merging because it is easy to make mistakes that might result in build instability. After you have finished merging, compile the resulting source and run unit tests to test for major breaks.

Additional Resources


Last edited Jul 18, 2007 at 11:24 PM by jtaylorsi, version 7

Comments

No comments yet.