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:
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!