Sharing files creates a link in one repository to a file in another repository within the same branch. This lets you maintain common code while eliminating the need to work with multiple copies of the same source file. Operations on the shared file are applied to the base (linked to) file. When a file is shared, a shared history and filename are maintained. Only the file location is different. If a file or repository is shared in a branch, any subsequent branches maintain the defined shared files.
The Share Files dialog box opens.
Click the plus sign to expand the repositories tree.
The files are now shared. Notice the file is listed in each repository.
Did you know? |
For example, WysiCorp has 2 products. Repositories are created for each product in the
same mainline branch. When software is released, all files in the product repositories,
including all subrepositories, are zipped and shipped. WysiCorp uses the same order form
(orderform.txt) for all products. A repository named Shared is created in the same mainline branch as the product repositories. The orderform.txt file is added to the Shared repository. The order form file is then shared with both product repositories. The orderform.txt file is the same in all three repositories. Checking out orderform.txt from any of the repositories marks it as checked out in all repositories. When the changed file is checked in, all files are updated. |