Editor: Dealing with Unreal Git Merge Errors
Description
As you develop using blueprints and source control, merge conflicts can arise as they are binary files and cannot be simply merged together. The main option to resolve these issues using Source Control is to take one or the other however this guide will demonstrate a method to merge the two using Unreal’s Source Control. This guide uses Git as the provider, however, Subversion, Plastic SCM and Perforce can be used as alternatives.
Learning Outcomes
- Setup Source Control on Unreal Editor using Git
- Understand how to merge a blueprint conflict
Instructions
Setup Source Control
Open up Editor and on the main Viewport screen, select Source Control
→ Connect to a Source Control
at the top left.
You’ll be presented with the setup screen. Select your provider, in this guide it’s Git, and fill in the login details if needed. If you’ve already set up source control, it’ll automatically fill everything in.
The final step is to select “Accept Settings”, and the setup is complete.
Commit using Unreal (Optional)
These steps describe how to commit your files to your local stash using the Editor. You can ignore these steps and submit using your own source control.
You will still need to push your changes to the remote using an external source control software!
When you have changes, select Source Control at the Top Right and click on Submit To Source Control
.
Fill in the change list description and click submit. NOTE: This will write it under the Commit’s Summary.
Icon description found at the top right of affected items.
As you work on your project, you’ll notice that icons will appear on the top right of blueprints and items. The above table describes what has happened to them.
That’s it! You’ve now committed your changes to your local repo! You’ll still need to pull and push using an external source control!
Merge Resolution
If a Merge conflict has occurred for a Blueprint, you can view the different versions within Unreal. By right-clicking on the blueprint in Unreal, select “Merge” under “Source Control”. This will open both the blueprint and the Merge Tool.
The Merge tool can be used to view the current state of the blueprint from the remote source, the common base version of the two and the current local version. Blueprint code from this view can also be copied from any of the Read Only windows into the actual blueprint file. This provides the user control of what gets merged from the differing files instead of choosing one blueprint over the over.
Limitations
- Unreal can only commit to your local stash. Pushing to the remote requires external tools.
- You can’t select specific changes during Merge resolution; it is only a viewer. You will need to copy code from this viewer and paste it into the conflicted blueprint code.
- You cannot lock or reserve files to prevent others from using the file.
Further Readings
https://docs.unrealengine.com/4.26/en-US/ProductionPipelines/SourceControl/InEditor/