Understanding File Differences and Conflict Types
On software development teams where more than one person is working on the same project, it is common for file differences to create conflicts. Team Foundation version control lets you resolve these conflicts. Conflicts can occur during the following operations:
Merging changes between branches
Getting files into your workspace
Checking in new versions of file.
Conflict Types
This topic contains information about the following conflict types:
Version Conflict
File name collision conflict
Local overwrite conflict
Version Conflict
Version conflicts can occur in Team Foundation version control with a check-in, get, or merge operation. In each case, the evolution of an item along divergent paths results in a conflict.
Check-in Two users check out the latest version of a file. The first user checks in changes; this creates a new version of the file. When the second user tries a check-in, there is a version conflict because the second user's changes were not made against the latest version of the file.
Get Two users check out the latest version of a file. The first user checks in changes; this creates a new version of the file. When the second user performs a get latest operation, there is a version conflict because the get latest operation is trying to update the checked-out file in the workspace.
Merge A branched file has been modified in both branches. A user tries to merge changes from one branch to the other. There is a version conflict because the file has been modified on both branches.
Resolving version conflicts involves either merging changes or selecting one set of changes over the other. For more information, see How to: Resolve Conflicts Between Two Files.
Version Conflicts
Local/Source Change |
Server/Target Change |
Resolve Options (Get or Checkin) |
Resolve Options (Merge) |
---|---|---|---|
Edit Rename Undelete |
Edit Rename Undelete |
Merge changes for me (if there are no conflicts) Merge changes in merge tool Undo my local changes Discard server changes |
Merge changes for me (if there are no conflicts) Merge changes in merge tool Keep changes in target branch Copy item from source branch This is the default selection. |
|
Delete |
Restore file and merge changes for me (if there are no conflicts) Restore file and merge changes in merge tool Undo my local changes Restore file but keep my changes |
Restore file and merge changes for me (if there are no conflicts) Restore file and merge changes in merge tool Discard changes from source branch Copy item from source branch |
Delete |
Edit Rename Undelete |
Undo my local changes Discard server changes |
Discard changes from source branch Delete item in target branch |
|
Delete |
Undo my local changes |
Discard changes from source branch |
|
|
|
Skip these conflicts (Indicates that conflicts of that type will not be acted upon.) |
File Name Collision Conflict
File name collisions can occur in Team Foundation version control with a check-in, get, or merge operation. In all three cases, the conflict results when two or more items try to occupy the same path in the source control server.
Check-in Two users each add a file to the same application. Coincidentally, the two users choose the same name for the new files. One user checks in his or her file. When the second user tries a check-in, there is a file name collision.
Get Two users add files with identical names to an application. One user checks in the file. When the second user tries a get latest operation, there is a file name collision. This is because the first user's file cannot be retrieved where the second user has added a file.
Merge An application has been branched and has then been worked on in both branches. In both branches, a file that has the same name has been added. A user tries to merge changes from one branch to the other. There is a file name collision because the file added to the source branch can not be branched where a file has already been added to the target branch.
File name collision can result from any operation that adds or moves items in the server path namespace. This includes operations such as add, rename, branch, undelete, and merge.
To resolve file name collisions, you need to select which item will ultimately occupy the source control server path. For more information, see How to: Resolve Conflicts Between Two Files.
File Name Collision Conflicts
Local/Source Change |
Server/Target Change |
Resolve Options (Get or Checkin) |
Resolve Options(Merge) |
---|---|---|---|
Add Branch Rename Undelete |
Add Branch Rename Undelete |
Undo my local changes Ignore conflict |
Discard changes from source branch Ignore conflict |
|
|
|
Skip these conflicts (Indicates that conflicts of that type will not be acted upon.) This is the default selection. |
Local overwrite conflict
Local overwrite conflicts only occur in Team Foundation version control during a get operation. These conflicts occur when a get operation tries to write over a writable file in your workspace. By default, the get operation will only replace files that are read-only. Resolving local overwrite conflicts involves either overwriting the file or checking out the file and merging changes.
Writable Files
Local/Source Change |
Server/Target Change |
Resolve Options (Get or Checkin) |
Resolve Options(Merge) |
---|---|---|---|
Not applicable |
Not applicable |
Overwrite local file/folder Ignore conflict |
Not applicable |
|
|
|
Skip These conflicts (Indicates that conflicts of that type will not be acted upon.) This is the default selection. |
Note
You cannot use the Resolve Selected Conflicts dialog box to resolve version conflicts that require a merge tool for resolution. This dialog box does not contain the option to merge changes in a merge tool. Also, if you select Merge changes for me and you find conflicts in the internal content, you cannot invoke the merge tool. Instead, you will be presented with the Unresolved Conflicts dialog box, which explains that you must resolve some files individually. If only one file cannot be resolved, the dialog box includes the filename. If there is more than one unresolved file, the dialog box will include the number of files.
These are the compare options:
Conflict Type |
Source Change |
Compare Options (Get or Checkin) |
Compare Options (Merge) |
---|---|---|---|
Version |
Edit Rename Undelete |
Local to Server Local to Original Server to Original |
Source to Target Source to Base Target to Base |
|
|
Local to Deleted Local to Original Deleted to Original |
Source to Deleted Source to Base Deleted to Base |
|
Delete |
Original to Server |
Deleted to Target |
|
|
Not applicable |
Not applicable |
Filename Collision |
Add Branch Rename Undelete |
Local to Server |
Source to Target |
Writable File |
Not applicable |
Not applicable |
Not applicable |
See Also
Tasks
How to: Resolve Conflicts Between Two Files
How to: Get the Source for Your Team Project
How to: Check In Pending Changes
Other Resources
Resolving Folder Differences and File Conflicts (Team Foundation Version Control)