Editor: Dealing with Unreal Git Merge Errors
Description
As blueprints are developed with source control, merge conflicts can arise as they are binary files and cannot be merged. 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.
Setting up Source Control
To set up the source control, open up Editor and on the bottom right of the screen, select Revision Control
→ Connect to Revision Control...
.
The window will be preset with a setup screen. Select the provider here. In this guide, use Git (beta version), and fill in the login details if needed. If it has already been set up, 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. These steps can be ignored and submitted using the external source control tools. Changes will still need to be pushed using an external source control software.
When changes exist, select the Revision Control
****at the bottom-right of the screen and click on Submit Content
.
As work is done in the project, several icons will appear on the top right of blueprints and items. The above below describes what has happened to them.
Once the changes have been committed to the local repo, they will still need to be pulled and pushed 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.
This will be presented on this screen when clicking merge. Select Start Merge
at the top to see the changes in the blueprints.
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 other.
Limitations
- Unreal can only commit to your local stash. Pushing to the remote requires external tools such as GitHub Desktop.
- 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 using Git as your revision control.
Further Readings
https://docs.unrealengine.com/4.26/en-US/ProductionPipelines/SourceControl/InEditor/