# Integrating files

To create a new codeline (also called branching) or propagate a bug fix or new feature from one codeline to another, you integrate the required files to the target codeline. To integrate files, you open them for integration, specifying source and target, and submit the changelist containing the open files.

If you are integrating changes into an existing codeline, you are required to resolve the files to ensure that you do not overwrite other users' changes and to preserve the file's revision history. For details about resolving, see Resolving files. Typical steps are:

1. Open files for integration.
2. Submit the changelist.
3. If there are conflicts, resolve the files.

When you open files for integration, you can specify the mapping of source to target using either a file specification or a branch specification.

- File specification: you specify the source and target files when you open files for integrate.
- Branch specification: you select a branch specification when you open files for integrate. Branch specifications enable you to predefine source and target codelines. For details about branch specifications, refer to the P4 User's Guide.

To open files for integrate: context-click the file and choose Integrate... The Integrate dialog is displayed. Specify integration options as follows:

- Don't copy target files to workspace: Create a branch in the depot without retrieving the corresponding files from the depot to your workspace.
- Enable baseless merges: Perform the integration even if source and target share no common ancestor, using the most-recently-added revision of the source file as the base.
- Disregard all integration history: Force the integration on all revisions of source and target files, even if some revisions have already been integrated. Typically used with a specified revision range.
- Disregard indirect integration history: Restrict selection of the base file revision to direct (parent-to-child or child-to-parent) integration history only. .
- Reverse mappings in branch view: For integrations that use a branch view as opposed to a file specification, integrate using the right side of the branch mapping as source and the left as target, which is the reverse of the default direction.
- Enable integrations around deleted revisions: If the target file has been deleted and the source file changed, this option re-branches the source file on top of the target file. If the source file has been deleted and the target file has changed, this option deletes the target file. By default, outstanding edits cannot be integrated with a deleted file.
- Do not sync target files to head revision: Use the workspace revision of the target file. By default, the head revision of the target file is automatically retrieved into the workspace before integrating.
- Propagate source filetypes to target files: Assign the target file the same file type as the source file (when integrating to existing target files).

To integrate using a branch specification: display the Branch Specification pane, context-click the desired branch specification, and choose Integrate Using Branch 'branch_specification'....