{"id":1311,"date":"2022-12-04T02:35:10","date_gmt":"2022-12-03T21:05:10","guid":{"rendered":"https:\/\/mutesoft.com\/spaces\/software\/?p=1311"},"modified":"2022-12-08T12:07:47","modified_gmt":"2022-12-08T06:37:47","slug":"p4-cheatsheet-frequently-used-p4-commands","status":"publish","type":"post","link":"https:\/\/mutesoft.com\/spaces\/software\/p4-cheatsheet-frequently-used-p4-commands.html","title":{"rendered":"Perforce (P4) Cheatsheet &#8211; Frequently Used P4 Commands"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Perforce (P4) Cheatsheet<\/h2>\n\n\n\n<p><strong>A cheatsheet is a crisp set of notes, or commands used as a quick reference<\/strong>. <a rel=\"noreferrer noopener\" href=\"https:\/\/www.perforce.com\/products\/helix-core\" target=\"_blank\">Perforce<\/a> 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, <a href=\"#download-p4-cheatsheet\">jump to the next section<\/a>.  <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>#<\/th><th>Category<\/th><th>Command<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><\/td><td>Access<\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_login.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 login<\/a><\/em><\/td><td>Log in to the Helix Core Server by obtaining a ticket<\/td><\/tr><tr><td>2<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_client.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 client &lt;name&gt;<\/a><\/em><\/td><td>Create or edit a client workspace specification and its view<\/td><\/tr><tr><td>3<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_client.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 client -d &lt;name&gt;<\/a><\/em><\/td><td>Delete the workspace with the given name<\/td><\/tr><tr><td>4<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_clients.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 clients<\/a><\/em><\/td><td>Display list of known clients<\/td><\/tr><tr><td>5<\/td><td>Sync<\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_sync.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 sync<\/a><\/em><\/td><td>Synchronize the client workspace with its view of the depot<\/td><\/tr><tr><td>6<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_sync.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 sync &lt;file&gt;#2<\/a><\/em><\/td><td>Copy the 2nd revision of the given file to the workspace<\/td><\/tr><tr><td>7<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_sync.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 sync @&lt;label&gt;<\/a><\/em><\/td><td>Sync the workspace with the files and revisions in the label<\/td><\/tr><tr><td>8<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_have.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 have<\/a><\/em><\/td><td>List files and revisions that are synced to the client workspace<\/td><\/tr><tr><td>9<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_flush.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 flush<\/a><\/em><\/td><td>Update a client workspace\u2019s have list without copying any files from the depot<\/td><\/tr><tr><td>10<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_clean.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 clean<\/a><\/em><\/td><td>Delete or refresh local files to match the depot state<\/td><\/tr><tr><td>11<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_reconcile.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 reconcile<\/a><\/em><\/td><td>Reconcile a workspace with changes made outside of the Helix Server<\/td><\/tr><tr><td>12<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_update.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 update<\/a><\/em><\/td><td>Update a client workspace without overwriting files that have changed since the last sync<\/td><\/tr><tr><td>13<\/td><td>Develop<\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_status.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 status<\/a><\/em><\/td><td>Reports which files need to be added, opened, or deleted<\/td><\/tr><tr><td>14<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_change.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 change<\/a><\/em><\/td><td>Create or edit a changelist description<\/td><\/tr><tr><td>15<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_changes.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 changes<\/a><\/em><\/td><td>Display list of pending and submitted changelists<\/td><\/tr><tr><td>16<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_print.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 print &lt;file&gt;<\/a><\/em><\/td><td>Retrieve a depot file to the standard output<\/td><\/tr><tr><td>17<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_add.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 add -c &lt;changelist&gt; &lt;file&gt;<\/a><\/em><\/td><td>Open a new file to add it to the depot<\/td><\/tr><tr><td>18<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_edit.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 edit -c &lt;changelist&gt; &lt;file&gt;<\/a><\/em><\/td><td>Open an existing file for edit<\/td><\/tr><tr><td>19<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_lock.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 lock &lt;file&gt;<\/a><\/em><\/td><td>Lock an opened file against other users submitting changes to the file<\/td><\/tr><tr><td>20<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_lock.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 lock -c &lt;changelist&gt;<\/a><\/em><\/td><td>Lock only files included in changelist<\/td><\/tr><tr><td>21<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_unlock.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 unlock &lt;file&gt;<\/a><\/em><\/td><td>Release a locked file but leave it open<\/td><\/tr><tr><td>22<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_revert.html\">p4 revert -c &lt;changelist&gt; &lt;file&gt;<\/a><\/em><\/td><td>Discard changes from an opened file<\/td><\/tr><tr><td>23<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_delete.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 delete -c &lt;changelist&gt; &lt;file&gt;<\/a><\/em><\/td><td>Open an existing file for deletion<\/td><\/tr><tr><td>24<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_opened.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 opened -c &lt;changelist&gt;<\/a><\/em><\/td><td>List files that are open in pending changelists<\/td><\/tr><tr><td>25<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_undo.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 undo<\/a><\/em><\/td><td>Undo a range of revisions<\/td><\/tr><tr><td>26<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_undo.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 undo @&lt;changelist&gt;<\/a><\/em><\/td><td>Undo the effects of a particular change<\/td><\/tr><tr><td>27<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_reopen.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 reopen -c &lt;changelist&gt; &lt;file&gt;<\/a><\/em><\/td><td>Change the type or changelist number of an opened file<\/td><\/tr><tr><td>28<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_diff.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 diff &lt;file&gt;<\/a><\/em><\/td><td>Display diff of client file with depot file<\/td><\/tr><tr><td>29<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_describe.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 describe &lt;changelist&gt;<\/a><\/em><\/td><td>View details of a changelist<\/td><\/tr><tr><td>30<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_submit.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 submit<\/a><\/em><\/td><td>Submit the default changelist files to the depot<\/td><\/tr><tr><td>31<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_submit.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 submit -c &lt;changelist&gt;<\/a><\/em><\/td><td>Submit the given changelist files to the depot<\/td><\/tr><tr><td>32<\/td><td>Merge<\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_branch.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 branch<\/a><\/em><\/td><td>Create or edit a branch specification<\/td><\/tr><tr><td>33<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_branches.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 branches<\/a><\/em><\/td><td>Display list of branches<\/td><\/tr><tr><td>34<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_merge.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 merge<\/a><\/em><\/td><td>Merge one set of files (and\/or the stream spec) into another<\/td><\/tr><tr><td>35<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_copy.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 copy<\/a><\/em><\/td><td>Copy files from one location in the depot to another<\/td><\/tr><tr><td>36<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_move.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 move &lt;file1&gt; &lt;file2&gt;<\/a><\/em><\/td><td>Move (rename) a file from one location to another within the branch<\/td><\/tr><tr><td>37<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_rename.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 rename &lt;file1&gt; &lt;file2&gt;<\/a><\/em><\/td><td>Alias of move command. Move a file from one location to another<\/td><\/tr><tr><td>38<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_resolve.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 resolve<\/a><\/em><\/td><td>Merge open files (scheduled for resolve) with other revisions or files<\/td><\/tr><tr><td>39<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_resolved.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 resolved<\/a><\/em><\/td><td>Show files that have been merged but not submitted<\/td><\/tr><tr><td>40<\/td><td>Shelve<\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_shelve.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 shelve -c &lt;changelist&gt;<\/a><\/em><\/td><td>Store files from a pending changelist in the depot, without submitting them<\/td><\/tr><tr><td>41<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_unshelve.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 unshelve -c &lt;changelist&gt;<\/a><\/em><\/td><td>Restore shelved files from a pending change into a workspace<\/td><\/tr><tr><td>42<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_reshelve.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 reshelve -c &lt;changelist&gt;<\/a><\/em><\/td><td>Copy shelved files from an existing shelf into either a new shelf or into an existing one<\/td><\/tr><tr><td>43<\/td><td>Label<\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_list.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 list -l &lt;label&gt; &lt;filespec&gt;<\/a><\/em><\/td><td>Create a list of files that can be used as a label<\/td><\/tr><tr><td>44<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_label.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 label &lt;name&gt;<\/a><\/em><\/td><td>Create a new label specification or edit an existing label specification<\/td><\/tr><tr><td>45<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_labels.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 labels<\/a><\/em><\/td><td>Display the list of defined labels<\/td><\/tr><tr><td>46<\/td><td><\/td><td><em><a href=\"https:\/\/www.perforce.com\/manuals\/cmdref\/Content\/CmdRef\/p4_tag.html\" target=\"_blank\" rel=\"noreferrer noopener\">p4 tag -l &lt;label&gt;<\/a><\/em><\/td><td>Tag files with a label<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">P4 Cheatsheet<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"download-p4-cheatsheet\">Download Perforce (P4) Cheatsheet<\/h2>\n\n\n\n<p>Download the printable single-page P4 cheatsheet in PDF format by clicking the below button.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-a89b3969 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button is-style-fill\"><a class=\"wp-block-button__link has-vivid-cyan-blue-background-color has-background wp-element-button\" href=\"https:\/\/mutesoft.com\/common\/download.php?f=P4-Cheatsheet.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Download P4 Cheatsheet<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>A cheatsheet is a crisp set of notes, or commands used for quick reference. The below table contains the list of most frequently used p4 (Perforce) commands. We present the commands with the syntax and the purpose of use.<\/p>\n","protected":false},"author":2,"featured_media":1327,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"none","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","_vp_format_video_url":"","_vp_image_focal_point":[],"footnotes":""},"categories":[32],"tags":[64,35,36],"class_list":["post-1311","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tools","tag-cheatsheet","tag-perforce","tag-tools"],"_links":{"self":[{"href":"https:\/\/mutesoft.com\/spaces\/software\/wp-json\/wp\/v2\/posts\/1311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mutesoft.com\/spaces\/software\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mutesoft.com\/spaces\/software\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mutesoft.com\/spaces\/software\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mutesoft.com\/spaces\/software\/wp-json\/wp\/v2\/comments?post=1311"}],"version-history":[{"count":15,"href":"https:\/\/mutesoft.com\/spaces\/software\/wp-json\/wp\/v2\/posts\/1311\/revisions"}],"predecessor-version":[{"id":1348,"href":"https:\/\/mutesoft.com\/spaces\/software\/wp-json\/wp\/v2\/posts\/1311\/revisions\/1348"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mutesoft.com\/spaces\/software\/wp-json\/wp\/v2\/media\/1327"}],"wp:attachment":[{"href":"https:\/\/mutesoft.com\/spaces\/software\/wp-json\/wp\/v2\/media?parent=1311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mutesoft.com\/spaces\/software\/wp-json\/wp\/v2\/categories?post=1311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mutesoft.com\/spaces\/software\/wp-json\/wp\/v2\/tags?post=1311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}