This allows you to hard reset to the original branch when a rebase goes wrong.
Isolate the commits that are troublesome while rebasing.
git rebase -i HEAD~n
Manually trigger Vim error
to abandon rebasing from completing
:cq
git add <file> git rebase --continue
Below example will fold 4 commits into the first commit:
pick a1b2c3d Commit message 1 squash d4e5f6g Commit message 2 squash h7i8j9k Commit message 3 squash l0m1n2o Commit message 4
Always prefer squash
over deletion
of commit