# Branching and Merging

Using P4Eclipse, you can branch Eclipse projects - for example, for release or experimental development - and merge changes between branches to obtain changes made by other users or to incorporate your changes into collaboratively-developed projects.

## Branching

To branch a project:

1. Right-click the project in the P4 Connections view and choose Integrate.
2. In the Target field, specify a location for the branched project, using Perforce depot syntax.( For details about Perforce depot syntax, refer to the P4 Users Guide on the Perforce Web site.)
3. If required, specify desired integration options. (Again, for details about Perforce integration, refer to the P4 Users Guide on the Perforce Web site.)
4. Click Integrate. P4Eclipse creates a changelist containing the files to be branched, marked for add.
5. In the P4 Pending Changelists view, right-click the changelists containing the branched files and choose Submit... The Perforce Change Specification is displayed.
6. Enter a description and click Submit. Perforce branches the files to the specified target location.

## Branch Specifications

To simplify integration, Perforce enables you to save a set of branch-to-branch mappings as a named branch specification.

To display the branch specifications for the current server, choose Window > Show View > Other... and browse to Perforce > P4 Branches. In this view, you can create or edit branch specifications and integrate changes.

To create a branch specification, click and, in the Branch dialog, specify the details. In the View field, specify the source/target mapping using Perforce depot syntax. Depot syntax supports the following wildcards:

- * matches all characters except slashes (use for a path component)
- ... matches all characters including slashes (use to specify a directory and all its subdirectories)

To integrate changes using a branch specification, right-click the specification and choose Integrate...

(For details about integration and depot syntax, refer to Introducing Perforce.)

## Merging

As with branching, to merge changes, you select the source project, choose Integrate..., and specify a target path. The difference is that, when you merge, the target files already exist and you are required to resolve them before Perforce permits you to submit.