Matt W
Matt W

Reputation: 12424

Rebasing sub branches caused conflicts

We have a branch A created from master, then another branch B created from that first branch A. In trying to rebase B onto A after a while of (mistakenly) not rebasing, the rebase operation repeatedly throws up conflicts.

Changes have been made to both A and B and on the same files.

Why does rebase throw up conflicts in this scenario and is there a (relatively) simple solution to (force?) rebase, rather than merging.

We solved the problem by (in one instance) manually comparing file changes and merging in a diff tool and (in another instance) simply creating a PR with squash.

Upvotes: 1

Views: 58

Answers (1)

jessehouwing
jessehouwing

Reputation: 114857

When there are conflicting changes in two different branches, no matter how you try to combine them, you're going to have to explicitly choose which changes to take and which ones to drop.

When doing a rebase, any conflict will pause the process, lets you manually fix the issue and stage the commit. Then the rebase process can continue applying the rest of the changes.

The system is quite clever, so subsequent changes in the same rebase action may go without a hitch.

There is no auto-magic solution.

Upvotes: 1

Related Questions