Merge Files

See Also

Merging is the process of combining differences in two or more changed copies of a file into a single, new version of the file.

VSS cannot resolve merge conflicts, but instead presents them to you for resolution. There are two methods that can be used for viewing and resolving merge conflicts visual merge and manual merge.

You choose which method to use on the General Options tab of the Options dialog box on the Tools menu. Visual merge is chosen by default for all merged files where conflicts are identified.

In VSS, a merge can occur in three different circumstances when using multiple checkouts, when explicitly merging previously branched files, and when getting a file.

In any merge, what happens is the same. VSS takes the file(s) with differences, compares them to the original file, then creates a resultant file containing all the changes. For example, if you check in a file that causes a merge, the file on your hard disk and the file in the project are then combined into a resultant file containing both sets of changes. This operation is sometimes referred to as a three-way merge.

Merge on Get

After a multiple checkout, there are two instances when changes can be merged in at Check In, and during a Get Latest Version command (only if you have the Replace Writable Files option in the Local Files Options tab set to Merge).

In this instance, differences between your local copy of a file and the version saved in the VSS database are merged into the local copy when you get the latest version.

Note   If a file is exclusively checked out, merge is not available when performing a Get Latest Version command.

After a Merge

After a merge, the file in your working folder is changed. If the merge was successful, that file represents the complete merge. If there was a merge conflict, VSS opens the Visual Merge window (unless you have opted for the manual merge). The Visual Merge window gives you a point-and-click way of choosing how to resolve each conflict, at the end of which you can save the completely merged file. Visual Merge is the recommended way to resolve your conflicts.

For those who have worked with earlier VSS versions or for batch scripts that must run without user intervention, you can choose the manual VSS merge to place identifying markers (six consecutive equal signs) in your file. In any text editor, you can search for and edit them manually.

In addition, after completing a merge, VSS observes the following rules.

When the conflicts are resolved, check the file in again. VSS rechecks for any new conflicts, and if all conflicts have been resolved, then it checks in the file.

For information on how to use merge in VSS, refer to: