Sharing is appropriate when you want all subsequent changes to a file to be
reflected in each project where the file is shared.
You may want to put a copy of a file into a project, however, and then modify
the copy independently of the original.
Making a Visual SourceSafe copy of a shared file independent of the original
is called branching.
To branch a shared file, follow these steps:
STEP BY STEP
2.8 Branching a Shared File in VSS
Select the file in the Visual SourceSafe window.
Choose SourceSafe, Branch from the Visual SourceSafe menu (see Figure 2.20).
FIGURE 2.20 - Branching a file.
You will notice that the file's icon changes: It no longer appears doubled,
but rather now appears as a simple document icon.
The branched file now has an independent life, and any changes you make to
the file will not be reflected in the original file.
Branching can be appropriate in cases where there is an existing distributed
version of a project that needs to be fixed, while at the same time in a separate
project you want to begin working on a major new version. Imagine the following
scenario, for example:
- Version 1.0 is the current production version of your application.
- Development team A (which may be only one person, of course) will be responsible
for ongoing patches to version 1.0 and will work on version 1.1.
- Development team B (once again, this might be a single person—in fact,
it might be the person who is development team A, but just wearing a different
hat) is responsible for the new major release and will work on version 2.0.
To implement the preceding scenario with Visual SourceSafe, you should take
the following steps:
Label the project containing the files for version 1.0 if you haven't done
Create a new project folder for version 2.0.
Share the version 1.0 files to the version 2.0 project, and immediately
branch the shared files.
You now have two independent projects based on version 1.0, but the projects
can now diverge along independent development paths.
You can branch a file at the same instant that you share it by checking the
Branch after Share check box on the Share dialog box.
Suppose, for example, that your project contains a module that processes sales
orders. You need to create a new module that processes purchase orders. A lot
of the general logic will be the same as the logic for processing sales orders,
but the details will differ.
In this case, you will want to make a copy of the sales-order processing module
as a starting point for the purchase-order processing module. As soon as you make
the copy, you want to begin making independent changes. You therefore use the
Branch after Share option at the instant that you share the files for this module.