Perforce (P4) Cheatsheet – Frequently Used P4 Commands

Perforce (P4) Cheatsheet

A cheatsheet is a crisp set of notes, or commands used as a quick reference. Perforce is a widely used modern version control system. The below table contains the list of most frequently used Perforce (P4) commands. We present the Perforce (P4) commands with the syntax and the purpose of use. Also, the commands are grouped by their categories. With this cheat sheet, we believe you can work with p4 cli confidently. To get a downloadable and printable P4 Cheatsheet in PDF format, jump to the next section.

Accessp4 loginLog in to the Helix Core Server by obtaining a ticket
2p4 client <name>Create or edit a client workspace specification and its view
3p4 client -d <name>Delete the workspace with the given name
4p4 clientsDisplay list of known clients
5Syncp4 syncSynchronize the client workspace with its view of the depot
6p4 sync <file>#2Copy the 2nd revision of the given file to the workspace
7p4 sync @<label>Sync the workspace with the files and revisions in the label
8p4 haveList files and revisions that are synced to the client workspace
9p4 flushUpdate a client workspace’s have list without copying any files from the depot
10p4 cleanDelete or refresh local files to match the depot state
11p4 reconcileReconcile a workspace with changes made outside of the Helix Server
12p4 updateUpdate a client workspace without overwriting files that have changed since the last sync
13Developp4 statusReports which files need to be added, opened, or deleted
14p4 changeCreate or edit a changelist description
15p4 changesDisplay list of pending and submitted changelists
16p4 print <file>Retrieve a depot file to the standard output
17p4 add -c <changelist> <file>Open a new file to add it to the depot
18p4 edit -c <changelist> <file>Open an existing file for edit
19p4 lock <file>Lock an opened file against other users submitting changes to the file
20p4 lock -c <changelist>Lock only files included in changelist
21p4 unlock <file>Release a locked file but leave it open
22p4 revert -c <changelist> <file>Discard changes from an opened file
23p4 delete -c <changelist> <file>Open an existing file for deletion
24p4 opened -c <changelist>List files that are open in pending changelists
25p4 undoUndo a range of revisions
26p4 undo @<changelist>Undo the effects of a particular change
27p4 reopen -c <changelist> <file>Change the type or changelist number of an opened file
28p4 diff <file>Display diff of client file with depot file
29p4 describe <changelist>View details of a changelist
30p4 submitSubmit the default changelist files to the depot
31p4 submit -c <changelist>Submit the given changelist files to the depot
32Mergep4 branchCreate or edit a branch specification
33p4 branchesDisplay list of branches
34p4 mergeMerge one set of files (and/or the stream spec) into another
35p4 copyCopy files from one location in the depot to another
36p4 move <file1> <file2>Move (rename) a file from one location to another within the branch
37p4 rename <file1> <file2>Alias of move command. Move a file from one location to another
38p4 resolveMerge open files (scheduled for resolve) with other revisions or files
39p4 resolvedShow files that have been merged but not submitted
40Shelvep4 shelve -c <changelist>Store files from a pending changelist in the depot, without submitting them
41p4 unshelve -c <changelist>Restore shelved files from a pending change into a workspace
42p4 reshelve -c <changelist>Copy shelved files from an existing shelf into either a new shelf or into an existing one
43Labelp4 list -l <label> <filespec>Create a list of files that can be used as a label
44p4 label <name>Create a new label specification or edit an existing label specification
45p4 labelsDisplay the list of defined labels
46p4 tag -l <label>Tag files with a label
P4 Cheatsheet

Download Perforce (P4) Cheatsheet

Download the printable single-page P4 cheatsheet in PDF format by clicking the below button.

Perforce (P4) Cheatsheet – Frequently Used P4 Commands
Be The First

Join our list to get instant access to new articles and weekly newsletter.

Tagged on:         
0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x