This is baked into Azure DevOps, I'm surprised they haven't pulled it over into GitHub.
Re:Two Years of Squash Merge (2019)
by wbronchart on Friday April 30, 2021 @09:13PM
(#27001873)
Yeah, you'll find endless threads on github issues of people complaining Github doesn't have this yet. It's a real pain
Plug: I wrote a script recently that merges github pull requests but preserves linear git history (basically, rebase + merge)
https://pypi.org/project/git-pr-linear-merge/