Normally git revert will create one revert commit for each commit you are
reverting. In this case we want a single commit for all the bad commits.
$ git log --pretty=oneline
efc4b4bc877b0a59d48c71c85b32413c6aef5504 Bad commit 2
979c1c9813ef02d84d8d22509f7740e58666c380 Bad commit 1
e7046aa0f8971096da85b282ef65f685363cad4c Good commit
$ git revert --no-commit efc4b4bc877b0a59d48c71c85b32413c6aef5504 979c1c9813ef02d84d8d22509f7740e58666c380
# because of the --no-commit flag, no commits have been made, but the necessary
# changes have now been added to your staging area
$ git commit -m "Revert last two commits"