Creating Branches

When you branch a codeline or stream, you create a copy of the source files and folders that is linked to the source by integration history. Typically you create a branch to enable concurrent work, perhaps to stabilize a release without impeding development or to permit experimentation without jeopardizing the stability of a mainline. Best practice is to keep the less stable branch up to date with its more stable neighbor by merging from it, then updating the neighbor with completed, stable work by copying. This approach ensures that no work is overwritten, and these policies are encoded into Perforce streams.

To branch a codeline or stream:

  1. Select the source folders and files, context-click and choose Branch...

    The Branch dialog is displayed.

  2. In the Choose target files/folder field, specify the branch that you want to create. (Note: if the target already exists, you are not branching: you're merging -- or integrating in the terminology of the Perforce Command-line Client).

  3. Configure any desired options (for details about options, see Merging Files Between Codelines) and click Branch. Files are opened for branch in a pending changelist.

  4. If you've chosen the auto-submit option, the pending changelist is submitted immediately. If you've chosen Add files to pending changelist, submit the changelist when you are ready to create the branch.

Click Set Defaults to open the Branch preferences page, where you can set default behaviors for the Branch dialog.

Note about Perforce terminology: The term branch refers to a codeline, but is sometimes used as shorthand for a branch specification or branch mapping, which is a stored source/target mapping that is used to record and simplify branch operation.