Creating branches

When you branchClosed(noun) A set of related files that exist at a specific location in the Perforce depot as a result of being copied to that location, as opposed to being added to that location. A group of related files is often referred to as a codeline. (verb) To create a codeline by copying another codeline with the 'p4 integrate', 'p4 copy', or 'p4 populate' command. a codelineClosedA set of files that evolve collectively. One codeline can be branched from another, allowing each set of files to evolve separately. or streamClosedA "branch" with built-in rules that determines what changes should be propagated and in what order they should be propagated., 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 Helix server streams. If you are hesitating whether to use streams, read the About streams section before you continue to get a better understanding of the advantages that streams entail.

To branch a codeline or stream:

  1. Select the source folders and files, right-click and choose Branch​ Files.

    The Branch dialog is displayed.

  2. In the Choose target files/folders 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 P4 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

In Helix server terminology, the term branch refers to a codeline, but it 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 a branch operation.