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

P4 CLI Documentation | 2025.2

# p4 revert (graph)

Discard changes from an opened file.

## Syntax

    p4 [g-opts] revert [-a -n -w -c changelistNumber] file ...

Syntax and naming conventions

## Description

Revert an open file to the revision that was synced from the depot, discarding any edits or integrations that have been made. You must explicitly specify the files to be reverted. Files are removed from the changelist in which they are open. Locked files are unlocked.

Suppose the user invokes `p4 revert` to cancel the editing of a file prior to resolving that file,

If the file belongs to a ... | the file reverts to ... | because ...
--- | --- | ---
classic depot | the depot revision you had in your workspace just before invoking p4 edit | In a classic depot, each file is tracked individually
graph depot | the file revision associated with the commit SHA of your workspace | In a graph depot, the p4 sync operation represents a snapshot of a collection of files with a single commit SHA

## Options

Option | Description
--- | ---
`-a` | The -a flag reverts only files that are open for edit, add, or integrate and are unchanged or missing. Files with pending integration records are left open. The file arguments are optional when -a is specified.
`-c change` | Reverts only those files in the specified changelist.
    p4 revert -c 345627 "//..."
`-n` | List the files that would be reverted without actually performing the revert. This lets you make sure the revert does what you think it does before actually reverting the files.
`-w` | Files that are open for `add` are to be deleted (wiped) from the workspace when reverted.

## Usage notes

Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required
--- | --- | ---
No | No | `list`

Your search for returned results