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

P4 CLI Reference | 2025.1

# p4 prune

Removes unmodified files from a stream.

The `p4 prune` command is equivalent to the `p4 obliterate` command, except that it can be done by the stream owner rather than an administrator.

## Syntax

    p4 [g-opts] prune [-d] [-y] -S stream

Syntax conventions

## Description

The `p4 prune` command permanently removes:

- unmodified files (files with one revision) from a stream that is no longer being used
- with the -d option, it also removes files whose only changes in the target stream were due to merges

Only the owner of a stream can prune it.

By default, `p4 prune` displays a preview of the results. To execute the operation, issue the command again, this time using the `-y` option.

After a stream has been pruned, files with more than one revision remain in the stream so that their edit history is preserved. Unmodified files are gone as if obliterated by an administrator with the `p4 obliterate` command.

Pruned files remain in client workspaces until the next `p4 sync` command runs, which removes them. If pruned files have been branched to a child stream, new integration records are generated to directly link the branched files in the child stream to the files in the parent stream to which they were previously related indirectly.

Mainline, task, and virtual streams cannot be pruned. To remove unmodified files from a task stream, delete or unload the stream using the `p4 stream` or `p4 unload` command. The unmodified files automatically go away when the stream spec does.

The stream owner who executes this command must have write access, as granted by the `p4 protect` command.

## Options

`-y` | Execute the command. Without this option, the command previews the results but takes no action.
`-S stream` | The name of the stream you want to prune.
-d | Performs a deep prune, which also removes files whose only changes in the target stream were due to merges.
`g-opts` | See Global options.

## Usage notes

Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required
--- | --- | ---
N/A | N/A | write for stream owner

## Related commands

An equivalent for `p4 obliterate -ahbi` | `p4 obliterate`

Your search for returned results