Basic Perforce Commands
In order to make a change to a Perforce depot, you first need to create a new Change List or CL.
However, to create a new CL, you must first create a comment file. Here is a UNIX example of getting a comment template, then changing the comment's default description, and finally saving the new comment to a comment (text) file:
A new CL cannot be created if the commentís default description is not changed. You can change the description of "Test comment." to something more descriptive if you want. And of course, you can change the filename to whatever you want too.
With this new comment file, create a new CL with this command:
Note that the output is also saved to a file, so that you can get the newly created CL number that you will need to use later.
At this point, you have an empty CL where you can either checkout (edit) a depot file or add a new file to the CL.
To checkout a file or marking a file for editing in a CL, use this command:
This command did not modify the file, but only marked it checked out and editable. Now you can edit the file like you normally would.
Remember that the "p4 edit" command is also the "p4 open" command, and please do not confuse the "p4 open" command with "p4 opened" command that is completely different.
Alternatively, you can add a file to a CL with this command:
Note that the files added this way must first exist in your workspace.
If you accidentally added a file to your CL that you no longer want checked out, you can undo the checkout with this command.
WARNING: This will delete any changes that you may have made to the file.
When you are done editing or adding files to the CL, you are ready to submit the CL to the depot using this command:
Submitting the CL saves the files and changes to the depot. Other users can now access your changes, and this may require conflicts to be resolved.
Finally, if instead of submitting your CL, you wanted to delete the CL, then run this command:
WARNING: This command will delete your CL only if you have no files checked out or opened in the CL, so you may have to revert or uncheckout all the files in the CL first (data may be lost by doing so).
by Phil for Humanity