Perforce Command Reference:   [Index]  [Prev] [Next]


p4 revert

Synopsis

Discard changes made to open files

Syntax

p4 [g-opts] revert -c [changelist#] filespec...

Description

p4 revert will discard changes made to open files, reverting them to the revisions last p4 sync'd from the depot. This command also removes the reverted files from the pending changelists they're associated with.

When files that have been opened by p4 delete are reverted, the files are reinstated in the client workspace. Reverts of files that have been opened by p4 add will leave the client workspace files intact. Reverts of files opened through p4 integrate will remove the files from the client workspace.

Options

-c changelist# Reverts only those files in the specified changelist. To revert files in the default changelist, use the text value default for changelist#.
g_opts See global options.

Usage Notes

Can File Arg Use
Revision Specifier?

Can File Arg
Use Revision Range?

Minimal
Access Level Required

No No open

p4 revert is unique in the Perforce universe in that it requires a file specification. The files that are reverted are those that lie in the intersection of the command line file specifications and the client workspace view.

Reverting a file that has been opened for edit will overwrite any changes made by the user to the file since the file was opened. Prudence suggests copying the file before running p4 revert.

Examples

p4 revert //depot/... Revert all open files to their pre-opened state.
p4 revert -c default Revert all open files in the default changelist to their pre-opened state.
p4 revert -c 31 *.txt Revert all files in changelist 31 with the suffix .txt in the current directory to their pre-opened state.

Related Commands

To open a file for add

p4 add
To open a file for deletion p4 delete
To copy all open files to the depot p4 submit
To read files from the depot into the client workspace p4 sync

To list all opened files

p4 opened
To bring the client workspace in sync with the files that Perforce thinks you have, clobbering open files p4 sync -f



Perforce Command Reference:   [Index]  [Prev] [Next]


Copyright 1998 Perforce Software.
Contact us at [email protected]
Last updated: 06/14/98