Perforce Cheatsheet
#
Perforce is a version control system known for its scalability and support for large-scale projects. It is used by development teams to manage source code, track changes, and coordinate work. Perforce integrates with various development tools and offers features suitable for enterprise environments.
Basic Commands
#
Command/Option | Example | Description |
---|
p4 init | p4 init | Initialize a new Perforce workspace |
p4 sync | p4 sync | Synchronize files with the depot |
p4 submit | p4 submit -d "description" | Submit changes to the depot with a description |
p4 add | p4 add <file> | Add files to the depot |
p4 delete | p4 delete <file> | Delete files from the depot |
p4 edit | p4 edit <file> | Open files for editing |
p4 revert | p4 revert <file> | Revert changes in files |
Branching and Merging
#
Command/Option | Example | Description |
---|
p4 branch | p4 branch <branch_name> | Create a new branch |
p4 integrate | p4 integrate //depot/branch/... //depot/main/... | Merge changes from one branch to another |
p4 resolve | p4 resolve | Resolve conflicts during merging |
Remote Repositories
#
Command/Option | Example | Description |
---|
p4 remote | p4 remote | List configured remote repositories |
p4 push | p4 push <repo_url> | Push changes to a remote repository |
p4 pull | p4 pull <repo_url> | Pull changes from a remote repository |
Tagging
#
Command/Option | Example | Description |
---|
p4 tag | p4 tag <tag_name> | Create a new tag |
p4 tags | p4 tags | List all tags |
p4 tag -d | p4 tag -d <tag_name> | Delete a tag |
User Management
#
Command/Option | Example | Description |
---|
p4 users | p4 users | List all users |
p4 user -o <user> | p4 user -o <user> | Show details of a specific user |
p4 user -i | p4 user -i | Edit or create a user |
File Operations
#
Command/Option | Example | Description |
---|
p4 where | p4 where <file> | Show the workspace and depot path for a file |
p4 diff | p4 diff <file> | Show differences between workspace and depot files |
p4 print | p4 print <file> | Print file contents from the depot |
Workspace Management
#
Command/Option | Example | Description |
---|
p4 workspace | p4 workspace | List all workspaces |
p4 client -o | p4 client -o | Show details of the current workspace |
p4 client -i | p4 client -i | Create or modify a workspace |
This cheatsheet covers common Perforce commands for version control, including workspace management, branching, merging, and remote operations.