Here is our current feature branch work flow ->
Problem:
If we do a merge --squash of the feature branch into the master, we have no issues. If we do a regular merge and then rebase we have to resolve all the conflicts again. On a feature branch with 100's of commits this is a major pain.
Is there a way to merge the feature branch back into master and rebase without conflicts?
I think you are fighting with this thing: Rebasing a Git merge commit
Try enabling rerere and using git rebase with -p option.
If I understood well, -p asks Git to try reusing previously-stored conflict resolutions upon stumbling on them during rebase, and rerere is a, say, "plugin", that enabled git to, literally, "REuses REcorded REsolutions".
Sometime ago there was an article here but it seems down now. Maybe you'll find that on internet-archive.
So, I've just looked up another one, it seems to explain things nicely:
Rerere Your Boat...
i.e.:
With
rerereturned on you can merge occasionally, resolve the conflicts, then back out the merge. If you do this continuously, then the final merge should be easy becauserererecan just do everything for you automatically.This same tactic can be used if you want to keep a branch rebased so you don't have to deal with the same rebasing conflicts each time you do it. Or if you want to take a branch that you merged and fixed a bunch of conflicts and then decide to rebase it instead - you likely won't have to do all the same conflicts again.
See the highlight. Seems just what you are doing.
But, before you jump with "geez, why isn't that enabled by default?!" take some care and see also this : https://stackoverflow.com/a/5521483/717732 and along with rerere learn the rerere forget. Just in case!
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