p4 clean
Restore client workspace files to match the state of corresponding depot files.
The p4 clean
command is equivalent to the
p4 reconcile -w
command.
Syntax
p4 [g-opts] clean [-e -a -d -I -l -K -m -n] [file ...]
Description
The p4 clean
command takes the following actions
when finding inconsistencies between the files in a user’s client workspace and
the corresponding depot files:
- Files present in the workspace but missing from the depot are
deleted from the workspace.Warning
Before you issue the command to have p4 clean delete files, make sure that you have successfully navigated to the correct directory. Otherwise, you might unintentionally delete local files that you want to keep.
- Files present in the depot but missing from your workspace are added to the workspace at the revision synced from the depot.
- Files modified in your workspace that are not opened for add, edit, delete, or integrate are restored to the last revision synced from the depot.
Files in your workspace that are opened for add, edit, delete, or integrate are not impacted by p4 clean
.
To limit the scope of p4 clean
to add, edit, or
delete, use the -a
, -e
, or -d
options. For example, using the -a
option finds files that have been added to the workspace but do not correspond to files in the depot, and deletes those files from your workspace.
By default, p4 clean
does not check the files or
paths listed in the P4IGNORE
file if they have been added rather than edited. To cause p4 clean
to check the files or
paths listed in the P4IGNORE
file whether or not those files have been added or edited, use the
-I
option.
To preview the set of proposed workspace reconciliation actions, use the
-n
option.
Options
|
Added files: Find files in the workspace that have no corresponding files in the depot and delete them. |
|
Deleted files: Find those files in the depot that do not exist in your workspace and add them to the workspace. |
|
Edited files: Find files in the workspace that have been modified and restore them to the last file version that has synced from the depot. |
|
Do not perform any ignore checking, which means to ignore any settings
specified by |
-m
|
Compare the file sync or submit time (in the depot) with the file modification time (in the workspace) to help determine whether the file has changed. Normally Helix Core Server uses file digests to determine whether files in the workspace differ from the head revisions of these files in the depot. This can be time consuming for large files. But when the timestamps are the same, the costly digest comparisons can be skipped. This option is only relevant if you are using clean to find changed files rather than files that were deleted or added. |
|
Display output in local file syntax with relative paths, similar
to the workspace-centric view of |
|
Preview the results of the operation without performing any action. |
file |
The files whose versions you want reconciled with their latest depot versions. If you omit this parameter, the files in your local working directory are used. |
-K
|
Suppress keyword expansion when updating +k type files on the client. See File type modifiers. |
|
See Global options. |
Usage notes
Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required |
---|---|---|
No |
No |
|
-
The
p4 clean
command produces output in depot syntax. To see file names and paths in local syntax, you must use the-l
option, or usep4 status
. Compare the output of the following commands, one without the-l
option, and the other one with the option.C:\test\local\client\copy\l>p4 clean -n bar //depot/copy/l/bar#none - deleted as c:\test\local\client\copy\l\bar C:\test\local\client\copy\l>p4 clean -n -l bar //depot/copy/l/bar#none - deleted as bar
- When called without arguments,
p4 clean
adjusts the specified files in your workspace to reflect their latest state in the depot.
Related commands
An equivalent for |