In the cleanup spam section:

Caveat: if there are no commits you want to keep (i.e. all the commits since the last merge into master are either spam or spam reverts) then git rebase will abort.

Wouldn't it be enough then to use git reset --hard to the desired last good commit?

regards, iustin