What is the difference between "Rollback..." and "Back Out Submitted Changelist #####" in Perforce P4V
I want to reverse the changes from one of my checkins. In the right-click context menu of the particular changelist, there are these two options:
- Rollback...
- Back Out Submitted Changelist
What is the difference between these two? In what situations should I use either one?
Solution 1:
Both of these operations restore a set of files to a previous state and are essentially faster, safer ways of undoing mistakes than using the p4 obliterate
command (and you don't need admin access to use them).
In the case of "Rollback...", this could be any number of files, even an entire depot. You can tell it to rollback to a specific revision, changelist, or label. The files are restored to the state they were in at the time of creation of that revision, changelist, or label.
In the case of "Back Out Submitted Changelist #####", the restore operation is restricted to the files that were submitted in changelist #####. Those files are restored to the state they were in before you submitted that changelist, provided no changes have been made to those files since. If subsequent changes have been made to any of those files, Perforce will tell you that those files are now out of date. You will have to sync to the head revision and then resolve the differences. This way you don't inadvertently clobber any changes that you actually want to keep.
Both operations work by essentially submitting old revisions as new revisions. When you perform a "Rollback...", you are restoring the files to the state they were in at a specific point in time, regardless of what has happened to them since. When you perform a "Back out...", you are attempting to undo the changes you made at a specific point in time, while maintaining the changes that have occurred since.
Solution 2:
Reverse a changelist submission
You cannot undo a successful changelist submission, but you can reverse previously submitted changes in two ways:
Rollback restores a file or set of files back to a specified changelist, date or revision. Any changes made after that point in time are not retained. Back out removes specific changes made at a given changelist, date or revision but allows a user to keep changes made in subsequent revisions.
For details please refer to https://www.perforce.com/perforce/r13.1/manuals/p4v/Working_with_changelists.html
Solution 3:
Backout restores or undoes our changes. The way it does this is that, P4 undoes the changes in a changelist (default or new) on our local workspace. We then have to submit/commit this backedout changelist as we do other changeslists. The second part is important here, as it doesn't automatically backout the changelist on the server, we have to submit the backedout changelist (which makes sense after you do it, but i was initially assuming it does that automatically).
As pointed by others, Rollback has greater powers - It can restore changes to a specific date, changelist or a revision#
Solution 4:
Rollback... will prompt you to select a folder to rollback, ie, it will work on specific folders, and you can rollback to labels or changlists or dates. Back out works on the files in specific changelists.