Perforce refresher

What most studios use, mapped onto the git you know · 9 min

In one breath

Perforce (Helix Core) is centralised: one server holds the history, and your workspace syncs the files you map. You check out a file before editing (which can lock it), group edits in a changelist, and submit straight to the server. There's no local commit and no push. Shelving shares work without submitting it. Streams are its branches.

The vocabulary

PerforceMeans
DepotThe repository on the server, e.g. //WadOfGore/main/...
Workspace (client)Your local folder plus a mapping of which depot paths it contains. You can map only part of a huge depot
Sync / Get LatestDownload the latest (or a specific) version of the files you map
Check out (p4 edit)Tell the server "I'm editing this". Makes the file writable, and others see it's checked out
Exclusive checkout (+l file type)Only one person at a time. Standard for .uasset/.umap
Mark for add / deleteNew or removed files, which also go in a changelist
Changelist (CL)A group of file changes plus a description. The default changelist, or numbered ones you create to separate work
SubmitSend the changelist to the server. It's now history, with a CL number, for everyone
ShelveUpload a changelist to the server without submitting. Used for code review, handing work to someone, or backup
ResolveMerge your version with a newer one someone submitted (the conflict step)
StreamsManaged branches: mainline, development, release. Changes merge down (from more stable) and copy up (to more stable)
P4VThe desktop app. p4 is the command line

Git ↔ Perforce translation

GitPerforceWatch out
clone / pullCreate workspace / SyncYou can sync only some paths, or an older revision
Just editCheck out firstEditing without checkout: the file is read-only, or the server doesn't know you changed it
Staging + commitChangelist
pushSubmitCommit and push are one step. Submit means everyone has it now
Commit hashCL numberIncreasing numbers: CL 48213 is after 48212
BranchStreamMuch heavier than a git branch; not made casually
stash / PR branchShelveReviews (Helix Swarm) are usually done on shelved CLs
restore (discard edits)RevertSame word, different meaning! See below
revert (undo a commit)Back out / undo a submitted CL
Git LFS lockExclusive checkoutBuilt in, not an add-on
.gitignore.p4ignore (and the workspace mapping)
The classic mix-up: "revert"

In Perforce, Revert means "throw away my local changes to this file and undo the checkout". In git, revert means "make a new commit that undoes an old commit". A git user who reverts in P4V expecting the git meaning loses their edits.

A normal day in Perforce

  1. Get Latest (sync) before starting.
  2. Check out the files you'll touch. For assets, Unreal does this for you if Revision Control is connected (it asks, or auto-checks out on modify).
  3. Keep separate tasks in separate numbered changelists, not everything in the default one.
  4. Shelve for review if the team reviews (Swarm), then address comments.
  5. Sync again, resolve anything newer, build, then Submit with a clear description.
  6. Don't leave files checked out overnight that others need, especially exclusive ones. Teams notice.

Perforce + Unreal specifically

In an interview

"Have you used Perforce?" → "Yes, on [project]: check out, changelists, submitting, with exclusive checkout on assets. These days I mostly use git with LFS and locking, so I'm comfortable with both models: centralised with locking for binary-heavy work, and branches with pull requests for code." Name the project and what you actually did in it. Specifics are what make the answer believable.

Quiz yourself

What's a workspace, and why does it have a mapping?

Your local folder plus the list of depot paths it contains, so you can sync only the parts of a huge depot you need.

Git's commit + push is what single step in Perforce?

Submit (a changelist).

What does Revert mean in Perforce, and why is it dangerous for git users?

It discards your local changes and undoes the checkout. Git's revert creates an undo commit, so the same word could cost you your edits.

What's shelving for?

Storing a changelist on the server without submitting it, for code review, handing work over, or backup.

Why do studios use exclusive checkout for .uasset?

Binary assets can't be merged, so only one person may edit one at a time.

Streams: what do "merge down" and "copy up" mean?

Merge down: bring changes from a more stable stream into a less stable one. Copy up: promote finished work to a more stable stream.

What's Unreal Game Sync for?

Syncing to a changelist known to build, often with precompiled binaries, so non-programmers can work without compiling.

Why use separate numbered changelists?

To keep unrelated work apart, so each submit (and its review) is one coherent change, like one-idea git commits.