I want to be able to get a clean rebase on a branch someone else has worked on using a merge resolve conflict strategy.
What's the easiest way to accomplish that?
Can I reuse their previous conflict resolutions along the way?
CodePudding user response:
You might still need to resolve conflicts, but I would look into git rerere
that I mentioned in "Are there any downsides to enabling git rerere?".
You can activate rerere and train it, in order for git to record past conflict resolution.
CodePudding user response:
The easiest way to accomplish this (assuming main
is the branch to rebase on top of) would be
git branch someone_elses_branch.rebased someone_elses_branch
git rebase main someone_elses_branch.rebased
This will have git attempting to apply the commits from someone_elses_branch.rebased
on top of main
and if there is a significant amount of changes between the common merge base and the top of main
you might end up with conflicts due to the aggregate of them being applied at once, while if you had rebased the branch just one commit at a time you could have avoided some of them.
Therefore you could try out using git-imerge instead which basically does that, rebasing incrementally along all commits on a branch.