Branching a version

When you branch a version of a folder you create a copy of that folder in order for it to evolve on a divergent path.

This procedure assumes you will use an alternate TFS workspace to manage your branch version. You will begin this task in the Source workspace (i.e., the working folder that contains the directory you will copy.) In our examples below we begin in TFS workspace Moses_mmplugin_trunk.

  1. In the Source Control view, right-click the project or project directory you wish to branch and from the context menu select Branch... (Note: Image below shows context menu truncated for space preservation; the Branch option is actually lower down in the menu.)

  2. The Branch dialog inserts the server Source path of the directory you selected in Step 1. The Target path represents the location to which you will save your branch. You can accept the appended name and location, (which by default is the source directory) or you can modify the location and name as illustrated in step 4 below.

    You do not have to branch the Latest Version. You can also branch by Changeset version, Date, Label, and Workspace Version by selecting from the Branch from Version drop-down menu. For an explanation of version types and their associated dialogs, see the User Guide section, Selecting a Version Type from the version drop-down menu. Click the Browse button to select a different Target path. Note: The target path need not be mapped for this step.

  3. In the Browse For Server Folder dialog, select a directory for your branch version. In the example below, we select directory v2.1 in the branches directory for our documentation project. Note: If you wish to branch to a directory that does not yet exist you can create a new directory and add it to TFS before proceeding with this step.

    In the Branch dialog, you can retain the original name of a directory when you branch to a target location other than the current folder.

  4. Because we are selecting a different workspace and target location from the Source, uncheck the check box Create local working copies for the new branch; (you will be able to download these during a later step.) Click OK to initiate the branching operation.

  5. When the branching operation is complete, the Pending Changes | Source Files view displays the branched files as pending a "branch" change. You will need to check these files in to commit the new branch version to TFS. Enter a comment or associate a work item or check-in note if you'd like, and click the check-in icon.

  6. Return to the Source Files view and navigate to the location where you created the branch. Verify the branch version has been created. The directory will be dimmed and the Latest status displays "Not mapped." This will change when you complete the next section.

Working with your Branch version
  1. Switch to an alternate TFS workspace or create a new TFS workspace for your branched project. In our example we switch to Moses_mmplugin_branch2.1. If necessary add a mapping to the branch workspace. In our example, we create a new local folder, TFS_branch2.1 and map it to our server branch version.

  2. After adding a mapping to your branch TFS workspace, return to the Source Control view. After creating a mapping, the Latest status displays, Not downloaded.

  3. Use the Get Latest task to download the new server branch files to your the local folder you specified in your TFS workspace mappings. Right-click the new directory and select Get Latest. You can now work on your branch files.

Viewing Branch History

You can view the history and location of directories branched from a Team project. In your resource view right-click a project or directory you have branched and select Properties. The Branches tab displays the history and the version from which the branch was created.

Note: Folders may have a different branch version number than their containing files and may never change at all. This is because folders in TFS do not change versions when they have new files added or deleted from them or when files inside the folder have changed.


Related Tasks:

Getting the latest version
Managing TFS workspaces with Teamprise
Adding a working folder mapping to a TFS Workspace
Merging branched versions