Perforce Branching

I’m trying to sort out branching in Perforce for a small team, and I’m not sure if what I’ve come up with is right. We’ve just started using branches in Git for code, but use Perforce for content and figured, hey, if we branch in one, we should branch in both! Here’s my process:

  • Create a new Branch Mapping. Since this can’t be in the same directory as the source asset, I’ve been putting them somewhere like this: //[DepotName]/Content/Branches/[BranchName]/…
  • Individual assets are added to the branch by right-clicking them in P4V and choosing “Merge/Integrate…”, then using the above branch mapping.
  • At this point I see a local copy of the asset in the UE4 editor in a new “Branches/[BranchName]” folder open for merge. I can submit the new branch to the Depot for others to see, check out the file to work on, etc. But the original file is still in the source directory, free for anyone else to edit. My thought was to have teammates also check out the original files but not submit any changes, just to let everyone know that it’s actually in use.

  • We work on the branched asset and make commits as needed. When work on the feature is complete, right-click on the branch in P4V and choose “Merge/Integrate Using Branch Mapping [BranchMapping]”…
  • The original asset is checked out for integrate. Resolve the file to accept the version from the branch.
  • Submit the resolved original file, and now all teammates see the update on the original asset.

  • When the branch is no longer needed, I delete the branch mapping, mark the branched files for delete, and submit that changelist. When teammates sync, the files are gone but they seem to have to remove the empty folders manually. By the end of the feature, this is the workspace history:

294081-003.jpg

Is this anywhere close to correct? I’m used to completely swapping out all files in a project from branch to branch when using Git, so having multiple copies of an asset seems wrong somehow. But I’ve looked everywhere I could think of online over the past few days and couldn’t find many details on branching (let alone with Unreal). My main stumbling point is how to let others know an asset shouldn’t be worked on, but I’m not sure manually checking out the originals when branching is right. It would also be nice to “squash” commit comments when merging back to the master (to keep the history clean), and force the use of branches so everything committed to master can be reviewed first, but I’ve not seen any way to do these things yet (also haven’t looked much, until I can sort out the basics of branching).

Any pointers would be greatly appreciated!

Streaming depots make branching easier, but I think most people avoid branching and just develop everything in mainline because it’s simple. Branches aren’t really used for one-off feature development like in git, but rather minimized and used for release builds. Of course, every studio is different. It depends on the amount of complexity the team is willing to undertake. The biggest issue will be conflicts with uassets across branches. Here is a solution for that: Workflow on Fortnite | Unreal Fest Europe 2019 | Unreal Engine - YouTube

@Nagoshi @cannabis.cod3r Hi, I found this topic post as I’m trying to figure out how to get this to work. I’ve set up the RegisterStateBranches to initialise my two branches, and in the output log when refreshing an asset in in content browser it is logging the other branch path successfully (if this path is wrong, it logs an error). However the assets I would expect to provide any visual or warning, don’t. Anything obvious I could be missing, did you manage to get it to work? Does this require your depot to be a stream depot in order for this to work? Any info would be greatly appreciated. :slight_smile: