Question: How do I avoid conflicts?

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

Answer

Most conflicts can be automatically resolved by Team Foundation Version Control. The scenarios in which you are most likely to need a manual merge―and therefore are worth avoiding―are scenarios in which there are overlapping changes to the same lines of code, or where more than two developers are working on a file at the same time.

To view pending changes
  1. In Source Control Explorer, right-click the solution, project, folder, or file for which you want to see pending changes.
  2. Select View Pending Changes.

This method will show you all of the pending changes within the scope you have selected.

If you use the command line checkout tool, it will indicate which other users have checked out this file, including information about the nature of the users’ pending changes. In the following example, a file named Math.cs is checked out, and TFS provides a notification that two other users (James and Sally) are working on the file. The notification indicates exactly what type of pending change each user has in his or her local workspace (Edit and Rename) and confirms that the local version of the file (the current workspace version) is not based on the latest repository version.

c:\dev\projects\calc\src>tf edit math.cs
ExplorerScc.cs

$/MathProject/dev/calc/src/math.cs:
   opened for edit in Workspace21;contoso\james
   opened for rename in WS24;contoso\sally
   newer version exists in the repository


Communicate regularly with other developers to indicate the nature of your changes to a particular file, to help avoid overlapping changes that would need to be manually merged. Coordination is a good way to make sure that two developers do not work on the same part of the code, but otherwise there is nothing wrong with having two or more people editing different parts of the same file.

Additional Resources

Last edited Jul 18, 2007 at 10:43 PM by jtaylorsi, version 7

Comments

No comments yet.