Handle submodule conflicts by lapfelix · Pull Request #996 · git-up/GitUp
Resolves #282
I use submodules every day at work and I think GitUp is the best Git interface so this has been a regular issue for me for way too long 🤪
The basic UI I came up with looks like this:

It closely matches the current submodule diff UI, but with buttons to choose which commit should be chosen (as a side note, in a future update it would be interesting to also pull the title of each commits and display it in the diff/conflicts views as I don't know my commit SHA1s by heart).
The "sketchiest" part of this PR is probably in GCDiff.m lines 358-377. I've written an explanation in a comment right above the code to justify it, but it would be nice if the superfluous untracked diff entry was not returned by libgit2 at all, but I couldn't find any combination of diff options that could do that.
Before
Submodule conflicts weren't handled at all and any rebase that involves a submodule conflict errors out in GitUp (and the repository needs to be "Reset to Checkout..." to get a clean working directory again | Submodule conflicts can be handled with a "Choose ours" or "Choose theirs" button
Screen.Recording.2024-04-26.at.6.20.58.PM.mp4
After
Submodule conflicts can be handled with a "Choose ours" or "Choose theirs" button
Screen.Recording.2024-04-26.at.6.23.39.PM.mp4
Here's the repository I used for my tests:
test-repo-submodules.zip
Once #989 is merged, I could use it as a base to write a unit test that checks that submodule conflicts are well handled.
I AGREE TO THE GITUP CONTRIBUTOR LICENSE AGREEMENT