This documentation is archived and is not being maintained.

How to: Branch a File

Visual Studio 2005

Visual SourceSafe branching for shared files is introduced in Sharing and Branching. This topic provides some specific branching procedures. See also How to: Share and Branch a File.


When you branch a file and then delete the branched versions, the database does not recover space until all copies of the branched file in the database are destroyed.

Let's look at an example of branching. Suppose you are working on two programs for two clients. The two programs are virtually identical, but you want to tailor program behavior in one or two files. First, you share a project $/WORD to a new project $/CLIENT2. If $/WORD has subprojects, you recursively share them as well. You now have two projects that are identical in every way. Next, you select the few files you want to tailor in $/CLIENT2 and branch them. Now, when you modify these specific files in $/CLIENT2, your changes do not propagate to $/WORD. All the other files, however, are still shared between the two projects. If you modify any of the shared files, the changes will be propagated to $/WORD.

Here's another branching example. Suppose that after your project reaches version 3.1, development proceeds in two different directions. One team is working toward the next major release, the 4.0 version. The other team is working on a maintenance release, version 3.2.

You create a new project named $/PATCH to represent the 3.2 version. You branch all the files into it, using branching because you don't want the projects to track each other, since versions 3.2 and 4.0 are diverging, and changes made in one version are not automatically reflected in the other.

Later, you might want to merge the version 3.2 changes, for example, bug fixes or minor feature enhancements, into version 4.0. You can do this using the Merge Branches command. See How to: Merge File Versions.

To perform a basic branch operation:

  1. Select the file(s) to branch in Visual SourceSafe Explorer.

  2. On the Versions menu, click Branch.

  3. On the Branch dialog box, type a comment in the Comment box to describe the Branch operation.

  4. Click OK.

See Also