How to rebase stacked branches
git
When you have a stack of branches in GitHub and you need to add a commit, for instance the first one, the rest of the branches should be rebased to reflect that commit too. Using --update-refs
with rebase this simplifies the process a lot.
# Checkout the "top" branch in the stack
git checkout feature-xyz/part-3
# Rebase the tip and all intermediate branches
git rebase andrew/feature-xyz/part-1 --update-refs
You'll still need to checkout the intermediate branches and force-push them.
See the original article here.
I learnt this from @andrewlocknet