image-blog-vcs-perforce-cheat-sheet-commands
May 7, 2020

Perforce Cheat Sheet: Commands & Features in Helix Core

Version Control

Perforce Helix Core is a leading version control tool. But do you know all the Perforce commands and features? In this blog, we give you a Perforce cheat sheet to help you get started with Helix Core faster.

✨ Get the cheat sheet ✨

Back to top

What Is in the Perforce Cheat Sheet?

This Perforce cheat sheet covers:

Keep reading to go in-depth on each of these aspects of Perforce Helix Core.

Back to top

Get Your Copy of the P4V Cheat Sheet

You can save a PDF copy of the P4V cheat sheet for future reference.

➡️ download the cheat sheet

Back to top

Perforce Basics: How Helix Core Works

Helix Core is version control software from Perforce.

There are multiple clients that connect Helix Core. In this Perforce cheat sheet for Helix Core, we cover two primary clients:

Back to top

Get Started with Helix Core for Free

If you’re not using Helix Core yet, you can get started now for free for up to 5 users and 20 workspaces.

➡️ try Helix Core — free

 

Back to top

Perforce Commands: Helix Command-Line (P4) Cheat Sheet

The Helix Command-Line is where you use Perforce commands (also known as P4 commands) in Helix Core.

image-blog-vcs-perforce-commands

 

Develop

The following Perforce commands will help you get started in Helix Core.

 

Perforce Commands to Develop

p4 Command

What It Does

p4 add

Open a new file to add it to the depot

p4 change

Create or edit a changelist description

p4 changes

Display list of pending and submitted changelists

p4 client

Create or edit a client specification and its view

p4 clients

Display list of known clients

p4 clean

Delete or refresh local files to match depot state

p4 diff

Display diff of client file with depot file

p4 edit

Open an existing file for edit

p4 flush

Update a client workspace’s have list without copying any files

p4 have

List revisions last synced

p4 lock

Lock an opened file against changelist submission

p4 move

Move file(s) from one location to another

p4 opened

Display list of files opened for pending changelist

p4 print

Retrieve a depot file to the standard output

p4 reconcile

Make workspace consistent with depot

p4 rename

Move the location of files

p4 reopen

Change the type or changelist number of an opened file

p4 reshelve

Copy shelved files from an existing shelf

p4 resolve

Merge open files with other revisions or files

p4 resolved

Show files that have been merged but not submitted

p4 revert

Discard changes from an opened file

p4 shelve

Store files from a pending changelist into the depot

p4 status

Reports which files need to be added, opened or deleted

p4 submit

Submit open files to the depot

p4 sync

Synchronize the client with its view of the depot

p4 undo

Undo a range of revisions

p4 unlock

Release a locked file but leave it open

p4 unshelve

Restore shelved files from a pending change into a workspace

p4 update

Update workspace without clobbering files changed

 

P4 Commands vs Other Version Control Tools

Currently switching to Helix Core from another version control tool? Compare common commands:

Branching and Merging

The following Perforce commands will help you branch and merge more efficiently — and accelerate development velocity.

Perforce Commands For Branching & Merging

p4 Command

What It Does

p4 branch

Create or edit a branch specification

p4 branches

Display list of branches

p4 copy

Make target identical to source by branching, replacing or deleting

p4 integrate

Schedule integration from one file to another

p4 merge

Merge changes from one set of files into another

p4 populate

Branch files to target without requiring a workspace

p4 prune

Remove unmodified branched files from a stream

p4 stream

Create or edit a stream specification

p4 streams

Display a list of known streams

p4 switch

Switch to and/or create a new stream/branch (DVCS)

📘 Related Resource: Tips on Version Control Branching

 

Investigate

The following Perforce commands will help you investigate what’s happening in Helix Core.

Perforce Commands to Investigate

p4 Command

What It Does

p4 aliases

Get a listing of all currently defined aliases

p4 annotate

Print file lines along with their revisions

p4 cstat

List the changes not synchronized in the current client

p4 depots

Display list of depots

p4 describe

Display a changelist description

p4 diff2

Display diff of two depot files

p4 dirs

List subdirectories of a given depot directory

p4 filelog

List revision history of files

p4 files

List files in the depot

p4 fstat

Dump file info in format suitable for parsing by scripts

p4 grep

Print lines in files (or revisions of files) that match a pattern

p4 help

Print this help message

p4 ignores

Display the ignore mappings

p4 info

Print out client/server information

p4 integrated

Show integrations that have been submitted

p4 interchanges

List changes not yet integrated from source to target

p4 istat

Show the stream’s integration status

p4 sizes

Display size information for files in the depot

p4 where

Show how file names map through the client view

 

Jobs

The following Perforce commands will help you do Helix Core jobs.

Perforce Commands For Helix Core Jobs

p4 Command

What It Does

p4 fix

Mark jobs as being fixed by named changelists

p4 fixes

List what changelists fix what job

p4 job

Create or edit a job (defect) specification

p4 jobs

Display list of jobs

 

Labels

The following Perforce commands will help you work with labels.

Perforce Commands for Labels

p4 Command

What It Does

p4 label

Create or edit a label specification and its view

p4 labels

Display list of labels

p4 labelsync

Synchronize label with the current client contents

p4 tag

Tag files with a label

 

Security

The following Perforce commands are super commands that help admins strengthen security.

Perforce Commands For Security

p4 Command

What It Does

p4 group

Change members of a user group

p4 groups

List groups of users

p4 login

Login to Helix by obtaining a session ticket

p4 login2

Perform second factor authentication

p4 logout

Logout of Helix by removing or invalidating a ticket

p4 passwd

Set user password on server (and Windows client)

p4 protect

Modify protections in the server namespace

p4 protects

Display protections in place for a given user/path

p4 set

Set variables in the registry (Windows only)

p4 tickets

Display list of session tickets for this user

p4 trust

Establish trust of an SSL connection to a Helix service

p4 user

Create or edit a user specification

p4 users

Display list of known users

📘 Related Resource: Learn Even More P4 Commands

 

Back to top

Perforce Features: Helix Visual Client (P4V) Cheat Sheet

Helix Visual Client has many features you should know.

image-blog-vcs-perforce-features

 

Here we cover:

  • Toolbar
  • Views
  • Stream types
  • File status
  • Badges

Toolbar Shortcuts

The toolbar in P4V is where you perform key actions. Here are some helpful shortcuts. 

Perforce Features in the Toolbar

Feature

Shortcut

Description

Refresh

Option+Ctrl+R

Refresh P4V.

Get Latest Revision

Shift+Ctrl+G

Get latest revision of files.

Submit Changelist

Ctrl+S

Submit your changes.

Check Out

Ctrl+E

Drag file from workspace

tree to a pending changelist.

Diff Against

Ctrl+Shift+D

Drag and drop a file revision onto another revision to diff.

Timelapse View

Ctrl+Shift+T

Dynamically browse through a file’s history.

Revision Graph

Ctrl+Shift+R

See a file’s integration history: when it was added, branched, edited, merged, copied, or deleted.

Cancel

Ctrl+ period

Stop an action.

 

Views Shortcuts

Views in P4V are how you see progress. Here are some helpful shortcuts.

Perforce Features For Views

Feature

Shortcut

Depot Tree

Ctrl+9

Workspace Tree

Ctrl+0

Pending Changelists

Ctrl+1

Submitted Changelists

Ctrl+2

Branch Mappings

Ctrl+3

Labels

Ctrl+4

Workspaces

Ctrl+5

Jobs

Ctrl+6

Streams

Ctrl+7

Stream Graph

Alt+7

Remote Mappings

Ctrl+8

 

Stream Types

Perforce Streams helps teams automate branching and merging. Stream types define how code changes should flow. Here’s a quick overview of Stream types.

Perforce Stream Types

Stream Type

Description

Release

 

Used for fixing bugs, testing, and release distribution

Mainline

Serves as the base or trunk of a stream system

Development

Used for long term projects and major new features

Virtual

Used to narrow the scope and submit directly to parent

Task

Creates a lightweight branch for bug fixes and new features

📘 Related Resource: Learn More About Perforce Streams

 

File Status

File status icons indicate the status of each file. This helps developers avoid duplicating effort.

For example, there are file status icons to indicate:

  • In depot
  • Not in depot
  • Not mapped to workspace
  • Workspace differs from head revision
  • Imported from another stream
  • Deleted
  • Shelved
  • Symbolic link

📘 Related Resource: See What the Icons Look Like

 

Badges

Badges on file icons indicate a new status. You can see who is working on files, and when new changes are available.

For example, there are badges to indicate:

  • File in your workspace that differs from the head revision, which has been checked out = by you and another user
  • Marked for add
  • Marked for add by another
  • Marked for delete
  • Marked for delete by another
  • Checked out by you
  • Checked out by another
  • Open for edit by you
  • Open for edit by another
  • Add/move by you
  • Add/move by another
  • Delete/move by you
  • Delete/move by another
  • Workspace version is up to date
  • Workspace version is not latest version
  • Locked by you
  • Needs resolve (conflicting changes have been made)

📘Related Resource: See What the Badges Look Like

 

Back to top

Put Your Perforce Cheat Sheet to Practice with Helix Core

Now that you’ve learned all the Perforce basics, it’s time to put it into practice. Get started with Helix Core for free for up to 5 users and 20 workspaces today.

➡️ try Helix Core — free

Back to top