When working on a feature branch you should keep the branch up to date by rebasing on to your
You should also open a PR early, keeping it in a “Draft” state.
But what happens if there is a
force push to
main while your branch is open. Well, your PR starts to look very busy, showing all the commits that are different to
main. These often include commits that were not made by you.
So how can you fix it?
- Take a backup of your branch by renaming the feature branch to something like
- Create a new
feature-namebranch, branching from
- Cherry-pick the relevant commits from
backup/feature-nameonto the new