Perforce (Helix Core) has a broad command-line interface, and this guide is for engineers who need a fast, reliable command reference while working. It covers the core workflow, what key commands are used for, and a cleaned command list preserved from the original post.
Originally published on 2010-11-25; fully revised and updated.
This revision is based on the original post, Basic Perforce Command – P4 Command Reference, with improved structure and practical examples.

Perforce command workflow at a glance
This is the typical lifecycle for a basic P4 change: authenticate, sync, open files for change, resolve when needed, and submit.
flowchart TD
A[Set P4PORT P4USER P4CLIENT] --> B[p4 login]
B --> C[p4 sync]
C --> D[Open files for add delete integrate]
D --> E[p4 resolve]
E --> F{Conflicts left}
F -- yes --> E2[Resolve again]
E2 --> F
F -- no --> G[p4 submit]
G --> H[Changelist stored in depot]
Quick start: connect and verify your workspace
Before editing or submitting, verify server connection, identity, and workspace context.
export P4PORT=perforce.example.com:1666
export P4USER=alice
export P4CLIENT=alice_ws
p4 login
p4 info
p4 clients
p4 sync //depot/main/...Code language: JavaScript (javascript)
Command comparison for everyday work
Use this quick comparison when deciding which command to run next.
| Task | Primary command | What it does | Typical follow-up |
|---|---|---|---|
| Bring workspace up to date | p4 sync | Copies files from depot to workspace | p4 have, then edit/add/delete |
| Start a new file | p4 add | Opens file for addition to depot | p4 change, p4 submit |
| Remove a tracked file | p4 delete | Opens file for deletion from depot | p4 submit |
| Merge or branch work | p4 integrate | Opens files for branching or merging | p4 resolve, p4 submit |
| Handle merge conflicts | p4 resolve | Resolves differences between revisions | p4 submit |
| Undo local pending changes | p4 revert | Discards changes to opened files | p4 sync if needed |
| Publish pending work | p4 submit | Sends open file changes to depot | p4 changelists, p4 describe |
Example: create and submit a basic changelist
This example shows a small add/delete change and submission through a numbered changelist.
p4 sync //depot/main/...
p4 add docs/release-notes.txt
p4 delete config/old.properties
p4 change
# Note the changelist number created in the editor
p4 submit -c 12345Code language: PHP (php)
Example: integrate and resolve
p4 integrate //depot/release/... //depot/main/...
p4 resolve
p4 submitCode language: JavaScript (javascript)
Basic P4 command reference
The table below preserves the original command coverage and descriptions, cleaned for readability.
| Command | Description |
|---|---|
| p4 add | Open file(s) in a client workspace for addition to the depot. |
| p4 admin | Perform administrative operations on the server. |
| p4 branch | Create or edit a branch specification and its view. |
| p4 change | Create or edit a changelist specification. |
| p4 changelists | List submitted and pending changelists. |
| p4 changelist | Create or edit a changelist specification. |
| p4 client | Create or edit a client workspace specification and its view. |
| p4 clients | List all client workspaces currently known to the system. |
| p4 delete | Open file(s) in a client workspace for deletion from the depot. |
| p4 depot | Create or edit a depot specification. |
| p4 depots | Display a list of depots known to the Perforce server. |
| p4 describe | Provides information about changelists and the changelists’ files. |
| p4 groups | List groups of users. |
| p4 group | Add or delete users from a group, or set maxresults, maxscanrows, and timeout limits for members of a group. |
| p4 have | List files and revisions that have been synced to the client workspace. |
| p4 info | Display information about the current client and server. |
| p4 integrate | Open files for branching or merging. |
| p4 integrated | Show integrations that have been submitted. |
| p4 job | Create or edit a defect, enhancement request, or other job specification. |
| p4 jobs | List jobs known to the Perforce server. |
| p4 label | Create or edit a label specification and its view. |
| p4 labels | Display list of defined labels. |
| p4 lock | Lock an opened file against changelist submission. |
| p4 login | Log in to a Perforce server by obtaining a ticket. |
| p4 logout | Log out of a Perforce server by removing or invalidating a ticket. |
| p4 passwd | Change a user’s Perforce password on the server. |
| p4 rename | Renaming files under Perforce. |
| p4 resolve | Resolve conflicts between file revisions. |
| p4 revert | Discard changes made to open files. |
| p4 set | Set Perforce variables in the Windows registry. |
| p4 submit | Send changes made to open files to the depot. |
| p4 sync | Copy files from the depot into the workspace. |
| p4 tag | Tag files with a label. |
| p4 triggers | Edit scripts that run conditionally for submits, form updates, or external authentication integration. |
| p4 user | Create or edit Perforce user specifications and preferences. |
| p4 users | Print a list of all known users of the current server. |
| p4 verify | Verify that server archives are intact. |
| p4 workspace | Create or edit a client workspace specification and its view. |
Best practices and common pitfalls
- Run p4 info before major operations to confirm server, user, and workspace context.
- Use numbered changelists for anything non-trivial so you can track and review changes cleanly.
- Sync before integrate/resolve cycles to reduce avoidable conflicts.
- Use p4 have when troubleshooting version drift between local files and depot state.
- Treat admin-level commands (p4 admin, p4 verify, p4 triggers) as controlled operations.
- When uncertain about syntax on your server version, check p4 help <command>.
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals