Comment by xg15
2 days ago
> Binary files can't be meaningfully merged.
I think we really need more development of format-specific diff and merge tools. A lot of binary formats could absolutely be diffed or merged, but you'd need algorithms and maybe UIs specific to that format - there is no "generic" algorithm like for text-based files. (And even there, generic line-wise diffing if often more "good enough" than really good)
I think it would be awesome if we could get "diff/merge servers" analogous to the "language servers" for IDEs some day.
Git actually supports this, believe it or not, although it's a bit wonky (of course):
https://github.com/ewanmellor/git-diff-image/blob/master/REA...
https://zachholman.com/posts/command-line-image-diffs/
Sounds like an infinite rabbit hole :)
The alternative of preventing complex merge situations in the first place through file locking is low-tech, easy to implement, and automatically works on all current and future file formats.
Well, a concrete pain point where I had this problem was Unity scene files (a few years ago). Unity stored not just the assets but also the scene information in binary files, which made integrating that into git an absolute pain. (They made matters worse by also storing "last edit" timestamps in certain files, so git would show changes everywhere even if there weren't any. But that's another topic)
The problem was that the scene information was fundamentally visual (assets arranged in 3D space) so even a diffable text format wouldn't help you much. On the other hand, scenes are large enough that you often would want to work on them in parallel with other people.
I believe their first solution to that was the Asset Server that supported locking. But that still doesn't give two people the ability to work on a scene concurrently.
Eventually, some users went and developed a custom diff/merge tool to solve the problem.
https://discussions.unity.com/t/scene-diff-ease-your-sufferi...
Unity has had a text based scene format available as an option for a long time. Yes it’s complicated looking yaml but it’s diffable and mergeable. They also have a smart yaml merge tool.
An alternative approach (less powerful but simpler) might be to reversibly convert the binary files into a mergeable text-like form before committing them.
I've never done exactly that but I have occasionally decided how information will be represented in a data file with merging in mind.