简体   繁体   中英

How to use git rerere (or similar) for automatic resolution of “Submodule merge conflict”s?

I'm trying to rebase a branch B over a branch A, but one of the newest commits in A deletes one folder replacing it with a git submodule.

After running git rebase A , git stops at every single commit of B (about 200) asking me to resolve conflicts. Then I run git mergetool and I get:

Submodule merge conflict for 'isolate':
  {local}: submodule commit 0b28bb5dc58c86f38729a6f06c235bc564033556
  {remote}: deleted
Use (l)ocal or (r)emote, or (a)bort?

I tried to enable git rerere by running git config --global rerere.enabled 1 and I did call git rerere after having "resolved" (by just typing L ).

The problem is: by looking in the .git/rr-cache/ folder I can see that it has recorded one resolution, but it is about the only time (in over 20 resolutions) where I did have to really resolve a conflict.

Maybe rerere doesn't record this type of resolution? If that's the case, how could I do it?

At first I thought it would have been too tedious to do:

git mergetool
# type "l", type "enter"
git rebase --continue

but then I did this:

echo "l" | git mergetool && git rebase --continue

and it was a lot faster, so I just did it for all commits.

However, if anyone finds it, I'm still interested in a better solution :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM