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

P4 CLI Reference | 2025.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 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`` supported by `p4 diff` are:

  Option | Name
  --- | ---
  `-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 altogether; this option implies `-dl`.

- The `-s`options`` supported by `p4 diff` are:

  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