Why not just revert the offending commit? It would be a valid blip in history as mistake made and corrected.
It presupposes that the commits are clean and well-separated though.
Little difference, but if "as clean as possible" was the goal, I think that would be the cleanest.
[edit] added the little words that my keyboard seems to filter out.
Apart from anything else it allows a clean-slate "this is how it _should_ have been handled in the first place", rather than a separate git-fu move that was necessary or even relevant only because of the original indiscretion.
No, just `git revert` that terrible commit, then do a regular sensible merge/rebase. Solves all problems in, like, two commands.