Compare a client workspace file to a revision in the depot.
options] [-f -t -Od] [-m
p4 diff runs a diff program on your workstation that compares
files in your workspace to revisions in the depot.
This command takes a file argument, which can contain a revision
specifier. If a revision specifier is included, the file in the client
workspace is diffed against the specified revision. If a revision
specifier is not included, the client workspace file is compared against
the revision currently being edited (usually the head revision). In
either case, the client file must be open for
edit, or the comparison
must be against a revision other than the one to which the client file
was last synced.
If the file argument includes wildcards, all open files that match the file pattern are diffed. If no file argument is provided, all open files are diffed against their depot counterparts.
By default, the diff routine used is the one built into the
command-line application. To change this diff routine to an external
diff program, set the
P4DIFF environment variable to point
to the new program.
Pass options to the underlying diff routine (see Usage Notes for details).
Force the diff (if no revision is specified, against the head
revision), even when the client file is not open for
Limit output to diffs (or status) of only the first
Limit output to only those files that differ.
Pass display options to the underlying diff routine (see Usage Notes for details).
Diff the revisions even if the files are not of type
See “Global Options”.
|Can File Arguments Use Revision Specifier?||Can File Arguments Use Revision Range?||Minimal Access Level Required|
ignore changes made within whitespace; this option implies
context output format, showing line number ranges and
numlines of context around the changes.
ignore line-ending (CR/LF) convention when finding diffs.
RCS output format, showing additions and deletions made to the file and associated line ranges.
summary output format, showing only the number of chunks and lines added, deleted, or changed.
unified output format, showing added and deleted lines with
numlines of context, in a form compatible with the
ignore whitespace altogether; this option implies
Show only the names of opened files that are different from the revision in the depot, or are missing.
Show only the names of files opened for integrate that have been resolved, but that have been modified after being resolved.
Show only the names of unopened files that are missing from the client workspace, but present in the depot.
Show only the names of unopened files in the client workspace that are different than the revision in the depot.
fileis compared with the depot, and listed with a status of
If you use the
-foption together with the
-sloption, files that are open for edit are also compared and their status is listed.
Show only the names of opened files in the client workspace that are identical to the revision in the depot.
To pass more than one option to the diff routine, group them together. For example:
p4 diff -dub file
specifies a unified diff that ignores changes in whitespace.
- The header line of a unified diff produced with the
-duoption for use with
patch(1)displays filenames in Perforce syntax, not local syntax.
- If a revision is provided in the file specification, the
-soptions compare the file(s) regardless of whether they are opened in a changelist or the workspace has been synced to the specified revision.
Compare the client workspace revision of file
Compare all open files in the client workspace to the revisions in the depot as of midnight on May 22, 1999.
Run the comparison on file
Revert all open, unchanged files.
This differs from
The first command shows all open, unchanged files. The second command
(This is the UNIX version of this command; it uses a pipe. Most operating systems have some equivalent way of performing these operations in series).
For more information about the