Johan Martinsson
Johan Martinsson

Reputation: 347

Can't rebase a branch containing solved merge conflicts

I want to rebase my whole git history on top of a new initial commit to be able to push it to SVN.

What I don't understand is why I have to solve the same merge conflicts again. They were once solved in the original history, why can't it just take those solutions?

I have published a minimal git-repository to reproduce the problem :

git clone https://github.com/martinsson/merge-conflict-reappears-in-rebase.git
git checkout yoda
git rebase master

Image of the history

I am aware of git rerere, but it seems like it would have had to be activated when those conflicts were resolved in the first place. Theoretically I could activate it, solve the conflicts then use it to solve the conflicts, but in practice that it seems almost impossible to get the conflict resolving to be identical to the original one.

I am aware I could push everything to SVN, using a merge or a git graft. But that defeats the purpose which is to port the commit logs to SVN.

Upvotes: 2

Views: 860

Answers (1)

Thom Parkin
Thom Parkin

Reputation: 346

The Rebase command reapplies all the changes represented by each commit on top of the target. That is why all the conflicts seem to be reappearing.

If you want to push the current state of the project to SVN as a 'clean' (new) commit, just check it out and push all the files to SVN. If you want to save the history then why Rebase?

Upvotes: 1

Related Questions