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

P4 CLI Documentation | 2026.1

# p4 diff (graph)

Diff utility for comparing workspace content to repo content. (For comparing two repo paths, see p4 diff2 (graph).)

## Syntax

    p4 diff [-doptions -soptions file ...]

Syntax and naming conventions

## Description

On the client machine, diff a client file against the corresponding revision in the repo. The file is compared only if the file is opened for edit. If the file specification is omitted, all open files are diffed.

## Options

`-d`options`` | Pass options to the underlying diff routine.

### The -d options modify output

Option | Description
--- | ---
`-db` | Ignore changes made within whitespace; this option implies `-dl`.
`-dc[`num`]` | Context output format, showing line number ranges and `num` lines of context around the changes.
`-dl` | Ignore line-ending (CR/LF) convention when finding diffs.
`-dn` | RCS output format, showing additions and deletions made to the file and associated line ranges.
`-ds` | Summary output format, showing only the number of chunks and lines added, deleted, or changed.
`-du[`num`]` | Unified output format, showing added and deleted lines with `num` lines of context, in a form compatible with the `patch(1)` utility.
`-dw` | Ignore whitespace. this option implies `-dl`.

### The -s options list files

Files are listed that satisfy the following criteria:

Option | Name
--- | ---
`-sa` | Show only the names of opened files that are different from the revision in the depot, or are missing.
`-sd` | Show only the names of unopened files that are missing from the client workspace, but present in the depot.
`-se` | Show only the names of unopened files in the client workspace that are different than the revision in the depot.
`-sl` | Every unopened `file` is compared with the depot, and listed with a status of `same`, `diff`, or `missing`.
`-sr` | Show only the names of opened files in the client workspace that are identical to the revision in the depot.

Your search for returned results