git rebase --preserve-merges
The doc says that "Merge conflict resolutions or manual amendments to merge commits are not preserved".
I understand how merge conflicts can be dealt by using rerere, but what exactly are manual amendments to merge commits? Does rerere deal with this as well? If not, is there a workaround?
What this sentence is saying (not very well) is that with
--preserve-merges,git rebaseactually re-does the merge.It's not possible in general to preserve the original merge, and Git simply does not try. Instead, it notes that original commit M was a merge with extra parent(s) p2, p3, ..., pN over and above the parent in the chain you're rebasing. So, when copying M, instead of doing
git cherry-pick <ID>, it doesgit merge p2 .... This, of course, makes an all-new merge.The rebase code does not adjust your
rereresettings at all, so you get whatever you have set.This is probably best demonstrated by example:
The line I added to
file2appears nowhere in either branch: I amended it manually.(Equivalently, I could let the merge do an auto-commit, and use
git commit --amendafterward, which shoves the original merge aside and puts a new merge in place using whatever I havegit added into the index since then.)