Corrupted conflicting asset files with git pull --rebase

Hello everyone.

I have an UE4 project with a small team and we use Git as a SCV. All *.uasset and *.umap files stores as LFS on the remote repository (GitLab).
Sometimes someone of the team makes changes on a file, e.g. *.uasset, and Pushes it. On the other side someone else has made changes on the same file and Committed it. Naturally, he has to perform Pull at first and then Push. To avoid ugly addition commit “merge branch ‘master’ of URL into ‘master’” we use command git pull --rebase origin master. During this process Git discovers conflicted files and offers to resolve them, and there is a problem: for some reason the local copy of the file corruptes, its size is less than 1 KB and it contains a few lines about its hash and size (prev and new), and of course we cannot choose this version of the file. If before Rebase operation save a copy of the file somewhere and move it back during Rebase operation when the original copy is corrupted, than we can choose this copy as usual, because the damaged copy was replaced by a normal one. But it’s not convenient to track manually all of binary files and copy them during Rebase, and then bring them back, and continue Rebase.

The question is how to avoid this strange behavior?

P.S. Sorry for my bad English.

Hi, I am the author of the Git plugin, and sadly this is a known issue with Git LFS.

LFS is treating conflicts in a different way than raw git, and the choice they make to replace the asset by a text breaks Unreal Engine.
There is nothing I can do, as far as I can tell.

The only good way to avoid the problem is to avoid conflicts altogether, which you can by using Git LFS 2 File Locks mechanism with Github, or by forbiding team members to work on the same assets at the same time using external communication tools.


It’s sad to hear it… So we already decided to switch to Perforce instead of Git. It took more efforts to configure, but work with it is much more comfortable and reliably on such projects with a small team. However, the Git is more suitable for code projects.
Anyway, thank You for the reply. =)

Yes, we are using Perforce for our own real game, but I keep using git for any prototype I make.
For local source control Git is awesome! So easy to setup