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.
# | Category | Command | Purpose |
---|---|---|---|
Access | p4 login | Log in to the Helix Core Server by obtaining a ticket | |
2 | p4 client <name> | Create or edit a client workspace specification and its view | |
3 | p4 client -d <name> | Delete the workspace with the given name | |
4 | p4 clients | Display list of known clients | |
5 | Sync | p4 sync | Synchronize the client workspace with its view of the depot |
6 | p4 sync <file>#2 | Copy the 2nd revision of the given file to the workspace | |
7 | p4 sync @<label> | Sync the workspace with the files and revisions in the label | |
8 | p4 have | List files and revisions that are synced to the client workspace | |
9 | p4 flush | Update a client workspace’s have list without copying any files from the depot | |
10 | p4 clean | Delete or refresh local files to match the depot state | |
11 | p4 reconcile | Reconcile a workspace with changes made outside of the Helix Server | |
12 | p4 update | Update a client workspace without overwriting files that have changed since the last sync | |
13 | Develop | p4 status | Reports which files need to be added, opened, or deleted |
14 | p4 change | Create or edit a changelist description | |
15 | p4 changes | Display list of pending and submitted changelists | |
16 | p4 print <file> | Retrieve a depot file to the standard output | |
17 | p4 add -c <changelist> <file> | Open a new file to add it to the depot | |
18 | p4 edit -c <changelist> <file> | Open an existing file for edit | |
19 | p4 lock <file> | Lock an opened file against other users submitting changes to the file | |
20 | p4 lock -c <changelist> | Lock only files included in changelist | |
21 | p4 unlock <file> | Release a locked file but leave it open | |
22 | p4 revert -c <changelist> <file> | Discard changes from an opened file | |
23 | p4 delete -c <changelist> <file> | Open an existing file for deletion | |
24 | p4 opened -c <changelist> | List files that are open in pending changelists | |
25 | p4 undo | Undo a range of revisions | |
26 | p4 undo @<changelist> | Undo the effects of a particular change | |
27 | p4 reopen -c <changelist> <file> | Change the type or changelist number of an opened file | |
28 | p4 diff <file> | Display diff of client file with depot file | |
29 | p4 describe <changelist> | View details of a changelist | |
30 | p4 submit | Submit the default changelist files to the depot | |
31 | p4 submit -c <changelist> | Submit the given changelist files to the depot | |
32 | Merge | p4 branch | Create or edit a branch specification |
33 | p4 branches | Display list of branches | |
34 | p4 merge | Merge one set of files (and/or the stream spec) into another | |
35 | p4 copy | Copy files from one location in the depot to another | |
36 | p4 move <file1> <file2> | Move (rename) a file from one location to another within the branch | |
37 | p4 rename <file1> <file2> | Alias of move command. Move a file from one location to another | |
38 | p4 resolve | Merge open files (scheduled for resolve) with other revisions or files | |
39 | p4 resolved | Show files that have been merged but not submitted | |
40 | Shelve | p4 shelve -c <changelist> | Store files from a pending changelist in the depot, without submitting them |
41 | p4 unshelve -c <changelist> | Restore shelved files from a pending change into a workspace | |
42 | p4 reshelve -c <changelist> | Copy shelved files from an existing shelf into either a new shelf or into an existing one | |
43 | Label | p4 list -l <label> <filespec> | Create a list of files that can be used as a label |
44 | p4 label <name> | Create a new label specification or edit an existing label specification | |
45 | p4 labels | Display the list of defined labels | |
46 | p4 tag -l <label> | Tag files with a label |
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.