p4 undo
Undo a range of revisions.
Syntax
p4 [g-opts] undo [-n -K] [-c change] [[FileSpec][revSpec]]
Description
The p4 undo
command opens files to undo a
set of previously submitted changes. The undone changes remain a part
of the file history, but the new revisions submitted after p4
undo
reverse their effect.
If a single revision is specified, the specified revision is undone. If a revision range is specified, the entire range is undone.
The workspace files opened by p4 undo
are synced to
the revision prior to those of the range and opened at the
most recent undone revision.
Files that are opened at a revision prior to
the head must be resolved prior to submission. To accomplish this, run
p4 sync
followed by p4 resolve
.
The -n option previews the operation without changing any files.
If -c change is included, files are opened in the specified pending changelist instead of the default changelist.
See the Example below.
Options
|
Preview the operation without changing any files. |
-K
|
Suppress keyword expansion when updating +k type files on the client. See File type modifiers. |
|
Open files in the specified pending changelist rather than the default changelist. |
|
See Global options. |
Usage Notes
Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required |
---|---|---|
Yes |
Yes |
|
To undo the effects of a particular change, issue this command:
$ p4 undo @change
To undo all changes made on April 1, 2018, issue this command:
$ p4 undo @2018/04/01,@2016/04/02
The above examples open files in the default changelist. To use a
numbered changelist, specify it with the -c
option.
Example
User Command | Result |
The user wants the content of revision #1 to become the latest revision. p4 undo //depot2/dirE/readme.txt#2 |
An undid action against that revision #2 is pending: //depot2/dirE/readme.txt#2 - opened for integrate |
The user submits the file. |
The content and history of revision #1 is now associated with the newly created revision #3 because an integrate action has completed. Submitting change 635.
|
The user decides to review the history of the file. p4 filelog //depot2/dirE/readme.txt |
The p4 filelog command returns the history, indicating that revision #3 has undone revision #2. //depot2/dirE/readme.txt |
Related Commands
Show integrations that have been submitted. |