lurscher lurscher - 1 year ago 60
Git Question

Why do I have to resolve the same conflict over and over?

When I do

git rebase branch1
in my
I get conflicts. I solve the conflict, do
git add <conflicted-add>
and then do
git rebase --continue
as git asks me to do. After that a new commit is applied. A new conflict shows up. But is the same conflict again! the same file!. I do it again,
git add
, the
git rebase --continue
, and then it all repeats again until I do repeat this for each commit being rebased on.

Why rebase is having me redo the same conflict resolution over and over again?

Answer Source

You should not be getting the same conflict over and over. Rerere will not help you here. It simply means that the codebase that you are trying to replay commits over is so different that each commit needs your help to adjust it. This is one of the reasons to favour merge over rebase. Rebase should be used only if necessary and not part of your regular workflow. Rerere will help a lot more in a merge/reset type workflow. Here is my workflow that avoids rebasing:

One way to ease some of the pain is to use a smart merging program like Beyond Compare. It is syntax aware and will solve quite a few conflicts that Git will (rightfully) refuse to do for you. Many times, these tools, when invoked, won't even open their UI, solve the issue and allow your git mergetool command to continue on to the next conflict. Remember to set "trust mergetool exit code" to true.