When I do git rebase branch1
in my branch1-local
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 in the same file. I do it again, git add
, the git rebase --continue
, and then it all repeats again until I repeat this for each commit being rebased on.
Why rebase is having me redo the same conflict resolution over and over again?
What you want is git rerere
which records conflict resolutions for you. The best introduction to this I have seen is now part of the Git Book, Tools chapter. In practice when you perform a rebase, you will end up stopping as before but you only have to check the merge conflict remains resolved then git add
it and continue.
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. In my opinion, 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: http://dymitruk.com/blog/2012/02/05/branch-per-feature/
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With