Use p4 revert to discard changes made to open files, reverting them to the revisions last p4 synced from the depot. This command also removes the reverted files from the pending changelists with which they're associated.When you revert files you opened with p4 delete, the files are reinstated in the client workspace. When you revert files that have been opened by p4 add, Perforce leaves the client workspace files intact. When you revert files you've opened with p4 integrate, Perforce removes the files from the client workspace.
Revert only those files that haven't changed (in terms of content or filetype) since they were opened.
• This lets you make sure the revert does what you think it does before actually reverting the files. Keep workspace files; the file(s) are removed from any changelists, and the server records the files as being no longer open, but the file(s) are unchanged in the client workspace. -c changelist# See the Global Options section.
Can File Arguments Use
Revision Specifier? Can File Arguments Use
Revision Range? Minimal Access Level Required
• p4 revert differs from most Perforce commands in that it usually requires a file argument. The files that are reverted are those that lie in the intersection of the command line file arguments and the client workspace view.
• Reverting a file that has been opened for edit will overwrite any changes you have made to the file since the file was opened. It may be prudent to use p4 revert -n to preview the results before running p4 revert.
Revert every file you have open, in every one of your pending changelists, to its pre-opened state. Revert every file open in the default changelist to its pre-opened state. Preview a reversion of all open .txt files in the current directory, but don't actually perform the revert. Revert all .txt files in the current directory that were open in changelist 31. Revert all unchanged files. This command is often used before submitting a changelist.
To forcibly bring the client workspace in sync with the files that Perforce thinks you have, overwriting any unopened, writable files in the process. p4 sync -f