I've observed that when merging a branch, and there's a submodule
conflict, sometimes Git will prompt a suggested resolution like so:

```
Failed to merge submodule Core (not fast-forward)
Found a possible merge resolution for the submodule:

If this is correct simply add it to the index for example
by using:

  git update-index --cacheinfo 160000
18c7a8e26fa78075d0f840526d0b830103c6072f "Core"

which will accept this suggestion.
```

When I run `git mergetool`, I get this prompt:

```
Submodule merge conflict for 'Core':
  {local}: submodule commit 6075077b3f2f213d312edd8286ed203b5e1232e2
  {remote}: submodule commit 565999a437e64cc83554da83a1d124f54daf9257
Use (l)ocal or (r)emote, or (a)bort?
```

I think it would be great if there was a 4th option added here, that
really just served as a vanity command for the aforementioned `git
update-index` command. For example:

```
Submodule merge conflict for 'Core':
  {local}: submodule commit 6075077b3f2f213d312edd8286ed203b5e1232e2
  {remote}: submodule commit 565999a437e64cc83554da83a1d124f54daf9257
  {suggested}: submodule commit 18c7a8e26fa78075d0f840526d0b830103c6072f
Use (l)ocal or (r)emote, (s)uggested, or (a)bort?
```

Typing `s` would execute this command, basically:

```
git update-index --cacheinfo 160000
18c7a8e26fa78075d0f840526d0b830103c6072f "Core"
```

My reason for recommending this is that there's no real convenient way
to accept the suggested resolution for the submodule. The only real
feasible way to use the suggestiong is to copy & paste the whole line
in the terminal, which is clunky.

I'd love to hear from the community to see what you all think about
this idea. Thanks for reading.

Reply via email to