Jump to content

How to rollback to a changelist using a command line(Not Gui)

  • Please log in to reply
2 replies to this topic

#1 Mohannad



  • Members
  • Pip
  • 1 posts

Posted 19 July 2018 - 02:23 PM


I am a perforce beginner user.
I am writing a script that adds, deletes and edits files and revert all changes at the end.

I tried to do the following to revert all changes:

p4 sync <path>  @oldRevision
p4 add <path>                                    # to add the deleted files
p4 sync
p4 resolve -ay
p4 submit

and this revert all changes and the deleted files but it does not remove the new added files.
How can I remove the new added file?

Thanks in advance

#2 p4rfong


    Advanced Member

  • Staff Moderators
  • 299 posts

Posted 20 August 2018 - 06:30 PM

To rollback a newly added file, simply delete the file
p4 delete <path>

or better
p4 delete <path> @<Changelist_where_file_was_added>,@>Changelist_where_file_was_added>

#3 Sambwise


    Advanced Member

  • Members
  • PipPipPip
  • 764 posts

Posted 20 August 2018 - 10:45 PM

The way to roll back everything without having to run different commands for different kinds of actions is the "p4 undo" command:


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users