git merge --squash
is now my preferred way of rebasing after a large amount of work and many merges (see this answer). If the branch you’re working on is called my-branch
and you want to rebase from main
then just do the following:
git checkout my-branch
git branch -m my-branch-old
git checkout main
git checkout -b my-branch
git merge --squash my-branch-old
git commit