Git rebasing on master after squash
Scenario: Your branches are A, B and master. B is dependent on A.
commits:
branches | commits |
---|---|
master | m |
A | m -> 1 -> 2 |
B | m -> 1 -> 2 -> 3 -> 4 |
Commits from A have been squashed and merged into master.
branches | commits |
---|---|
master | m -> 12 |
B | m -> 1 -> 2 -> 3 -> 4 |
You want to rebase B on master.
I prefer this:
git rebase --onto master A B
Otherwise: If B has X
commits on top of A (In this case X=2
)
git rebase --onto master HEAD~[X]
Reference: https://makandracards.com/makandra/45964-git-rebase-dependent-feature-branch-after-squash