Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Reference | 2025.1

# p4 resolve (graph)

Resolve integrations and updates to repo workspace files.

## Syntax

    p4 resolve [options] [file ...]

Syntax conventions

## Description

p4 resolve works only on files that have been scheduled to be resolved.

The commands that can schedule resolves are:

- p4 sync (graph)
- p4 update
- p4 submit (graph)
- p4 merge (graph)
- p4 integrate

Files must be resolved before they can be submitted. Resolving involves two sets of files, a source and a target. The target is a set of depot files that maps to opened files in the client workspace.

- When resolving an integration, the source is a different set of depot files than the target.
- When resolving an update, the source is the same set of depot files as the target, at a different revision.

The file argument specifies the target. If the file argument is omitted, all unresolved files are resolved.

Resolving can modify workspace files. The resolve process is a classic three-way merge. The participating files are referred to as follows:

- yours - The target file open in the client workspace
- theirs - The source file in the depot
- base - The common ancestor, which is the highest revision of the source file already accounted for in the target
- merged - The merged result

Filenames, filetypes, and text file content can be resolved by accepting `yours`, `theirs`, or `merged`.

Branching, deletion, and binary file content can be resolved by accepting either `yours` or `theirs`.

When resolving integrated changes, `p4 resolve` distinguishes among four results:

- entirely yours
- entirely theirs
- a pure merge
- an edited merge

The distinction is recorded when resolved files are submitted, and will be used by future commands to determine whether integration is needed.

In all cases, accepting `yours` leaves the target file in its current state.

The result of accepting `theirs` is as follows:

- Content: The target file content is overwritten.
- Attribute: The target's attributes are replaced.
- Deletion: The target file is deleted.
- Filename: The target file is moved or renamed.
- Filetype: The target file's type is changed.

For each unresolved change, the user is prompted to accept a result.

Content and non-content changes are resolved separately.

For content, `p4 resolve` places the merged result into a temporary file in the client workspace. If there are any conflicts, the merged file contains conflict markers that must be removed by the user.

p4 resolve is not supported for files with propagating attributes from an edge server in a multi-server environment.

### Prompts during the diff operation

p4 resolve displays:

- a count of text diffs and conflicts.
- the following prompts, where the options marked (*) appear only for text files, and the suggested action is displayed in brackets:

Accept |
`at` | Keep only changes to their file
`ay` | Keep only changes to your file
`* am` | Keep merged file
`* ae` | Keep merged and edited file
`* a` | Keep autoselected file

Diff |
`* dt` | See their changes alone
`* dy` | See your changes alone
`* dm` | See merged changes
`d` | Diff your file against merged file

Edit |
`et` | Edit their file (read only)
`ey` | Edit your file (read/write)
`* e` | Edit merged file (read/write)

Misc |
`* m` | Run $P4MERGE base theirs yours merged (Runs `$P4MERGEUNICODE charset base theirs yours merged` if set and the file is a unicode file.)
`s` | Keep only changes to your file
`h` | Print this help message
`^C` | Quit the resolve operation

The `merge (m)` option enables you to invoke your own merge program if one is configured using the P4MERGE environment variable. Four files are passed to the program:

- the base
- yours
- theirs
- the temporary file (The program is expected to write merge results to the temporary file)

## Options

The `-a` flag puts `p4 resolve` into automatic mode. The user is not prompted, and files that can't be resolved are skipped:

`-a` | Automatic mode: the user is not prompted, and files that can't be resolved are skipped.
`-as` | Safe resolve skips any files that need merging. Causes the workspace file to be replaced with their file only if theirs has changed and yours has not.
`-am` | Resolve by merging skips any files with conflicts Causes the workspace file to be replaced with the result of merging theirs with yours. If the merge detected conflicts, the file is left untouched and unresolved.
`-af` | Causes the workspace file to be replaced with the result of merging `theirs` with `yours`, even if there were conflicts. This can leave conflict markers in workspace files.
`-at` | Force acceptance of `theirs` and overwrites `yours`, that is, overwrites any changes made to the file in the client workspace.
`-ay` | Resolves all files by accepting `yours` and ignoring `theirs`. This preserves the content of workspace files.
-n | Previews the operation without altering files

Your search for returned results