You can use git reset
to remove the bad commits (including the revert).
Assuming your history looks like:
good -> good -> good -> rubbish -> revertRubbish
You can simply do
git reset HEAD~2
to make your version history look like:
good -> good -> good
If it's more complicated than that, say
good1 -> good2 -> rubbish -> good3 -> good4 -> revertGood4 -> revertGood3 -> revertRubbish
You may have to do something like:
git reset HEAD~6 //Deletes last 6 commits
git cherry-pick good3
git cherry-pick good4
with a resulting history of
good1 -> good2 -> good3* -> good4*
The asterisks indicate the code changes will be the same, just with a different hash than the original commits.