To remove a file from a pending changelist
and/or discard the changes in your workspace, you do:
$ p4 revert -k <files> # keep your workspace unchanged
$ p4 revert <files>
Like removing a file from a Perforce pending changelist
, you can remove changes for your stage
. It won't touch you working directory by default. But you can reset your local changes to the most recent commit (dangerous! no undo!) with --hard
.
$ git reset <files>
$ git reset --hard <files>
NOTE
As you can see, while Perforce usesrevert
, Git usesreset
.
To undo an already submitted changelist, Perforce offers the Back Out
operation. It batches several operations: sync, edit, resolve and submit.
With Git, you can automatically generate a new commit that undoes a specified commit:
$ git revert <commit>
You can then push this commit to any remote branch.
![]()
Git
reset
vs gitrevert
(image source: atlassian.com)
- perforce
revert
is NOT git revert but gitreset
- perforce
back out
vs gitrevert