I just started using Perforce after using Git for a year. Is there any equivalent of a git local commit to my branch in perforce.
Essentially, if I want to work on a complex task which might need undoing and redoing of my specific changes, is there any way to accomplish this in Perforce? The way I would do it in Git would be committing my changes to a branch and having several commits within the branch before merging in to master.
Today it is popular among professional teams of all scales, from indie developers to large enterprises, as well as critical open source projects such as Android and the Linux kernel. Yet Perforce, a commercial centralized SCM system, still resonates with game developers and other subsets of software developers.
Therefore, Git is a distributed model that helps developers change their source code, commit, push, and merge easily. Perforce is a centralized model, which helps developers to reuse the code and merge them easily. The centralized model helps developers to commit the code to a central server.
The git commit command captures a snapshot of the project's currently staged changes. Committed snapshots can be thought of as “safe” versions of a project—Git will never change them unless you explicitly ask it to.
I think p4 shelve
might be useful to you here.
Longer answer:
The way p4 works is that you have to unlock a file using p4 edit
, or add a new file using p4 add
. This will create a changelist that basically has all the files that are staged for your next commit.
p4 submit
can then be used to push (in git terminology) all the changes in your changelist to the repository/depot.
Now if you don't want to submit right away, you can shelve those changes using p4 shelve
. This will create a local checkpoint of your changelist which you can go back to, or undo. You may also create multiple shelved copies building one after the other. You can probably replicate all the functions of a git commit with this command.
See the p4 shelve
command reference for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With