Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interactive Rebase of merged branch

Tags:

git

git-rebase

I'm using git and I'm getting to this state:

      X --- Y --------- M1 -------- M2 (my-feature)
     /                 /           /
    /                 /           /
   a --- b --- c --- d --- e --- f (stable)

This happen when we work on 'my-feature' branch for more than a day. M1 and M2 are merged done from the stable branch to the feature branch. M1 and M2 may had merged conflicts which have been resolved. The whole idea of merging the stable branch into the feature branch is to handle the conflicts sooner rather than later.

Once the feature is complete we want to rebase the feature branch into one or two commits.

The problem is when we do interactive rebase git show us the same merge conflicts we already solve during M1 and M2 merges.

Is there way to make git reuse the merge decision we already done in M1 and M2 ?

like image 261
Ido Ran Avatar asked Jul 08 '12 11:07

Ido Ran


1 Answers

git rebase --interactive --preserve-merges
like image 129
forvaidya Avatar answered Sep 17 '22 18:09

forvaidya