Catalog / Perforce Cheat Sheet
Perforce Cheat Sheet
A comprehensive cheat sheet for Perforce, covering essential commands and workflows for version control.
Basic Commands
Connecting to the Server
|
Displays information about the Perforce server and client configuration. |
|
Authenticates the user with the Perforce server. |
|
Sets the Perforce server address. Example: |
|
Sets the Perforce username. Example: |
|
Sets the Perforce workspace (client). Example: |
Workspace Management
|
Opens the client specification form for editing. Allows you to configure the workspace. |
|
Lists all client workspaces known to the Perforce server. |
|
Synchronizes the workspace with the latest version of files from the depot. |
|
Synchronizes specific files to the latest version. |
|
Synchronizes the workspace to a specific label. |
|
Synchronizes the workspace to the revisions you had previously synced. |
Adding and Deleting Files
|
Marks new files for addition to the depot. |
|
Marks files for deletion from the depot. |
|
Detects files that have been added, deleted, or modified outside of Perforce and prepares them for submission. |
Change Management
Making Changes
|
Opens files for editing. Required before modifying a file under Perforce control. |
|
Discards changes made to opened files, reverting them to the last synced version. |
|
Displays the differences between the workspace version and the depot version of a file. |
|
Resolves conflicts between the workspace version and the depot version of a file after an update or merge. Important to do before submitting. |
Submitting Changes
|
Opens a new changelist for grouping related changes. |
|
Submits the opened files in the current or specified changelist to the depot. |
|
Submits the changes with a description from command line. |
|
Lists recent changelists. |
|
Describes a specific changelist, showing the files included and the description. |
Branching and Merging
|
Prepares files for merging changes from one branch to another. |
|
Merges changes from one branch to another (older command). |
|
Resolves any conflicts after the integration/merge. Crucial before submitting! |
|
Creates a new branch specification. |
Advanced Operations
Labels and Attributes
|
Creates or modifies a label specification. |
|
Lists available labels. |
|
Attaches a label to specific file revisions. |
|
Sets or retrieves file attributes. |
Streams
|
Lists available streams. |
|
Creates or modifies a stream specification. |
|
Switches the workspace to a different stream. |
|
Used for propagating changes between streams. |
User and Group Management
|
Creates or modifies a user specification (requires admin privileges). |
|
Creates or modifies a group specification (requires admin privileges). |
|
Lists all users. |
Troubleshooting and Tips
Common Issues
Conflicts during submit: Always Workspace out of date: Ensure you |
Permissions issues: Check file permissions and ensure the Perforce user has appropriate access. |
Network connectivity: Verify network connectivity to the Perforce server. Use |
Best Practices
Atomic Changesets: Group related changes into a single changelist for better tracking and management. |
Descriptive Comments: Provide clear and concise descriptions for each changelist. |
Regular Synchronization: Keep your workspace synchronized with the depot to avoid conflicts and integration issues. |
Branching Strategy: Develop a clear branching strategy to manage different development streams and releases. |
Command Aliases (Example)
You can create aliases for frequently used commands for efficiency. For example, in bash:
|