It seems like sometimes it does, but most of the time it results in needing to resolve conflicts on lots of commits.
Theory on fixing:
- Find the branch that was squashed merged as per now (lowest branch in the line that is no longer active - remote deleted or PR now merged)
- Find the sha of the common base between the branch being rebased from (the lowest branch in the line) - this should give us the most recent commit from the parent branch that also exists in the one being rebased.
- Check if that sha exists in the branch being rebased onto (prob the source branch e.g. main)
- If it doesn't then we run
git rebase --onto {sourceBranch} {sha} which should work.