Reverting a normal commit is easy. Try it on a merge commit and git answers that the commit is a merge and you must say which parent to keep. That one number is the whole trick.
git revert -m 1 <merge-commit>
A merge has two parents. -m 1 says that the first parent is the mainline, which is the branch you merged into. Git then creates a new commit that reverses everything the merge brought in relative to that side. Look at the parents with git show --format=%p -s <merge-commit> if you are not sure which is which.
The manual has a warning that matters. Reverting a merge declares that you never want the changes the merge brought in, so later merges of the same branch only bring in commits that were not part of the reverted merge. If the branch is fixed and merged again, the old changes stay out. The usual way around that is to revert the revert first, and the revert-a-faulty-merge how-to in the git documentation walks through it.
The revert is a new commit and does not rewrite history, so it is safe on a branch other people use. Run git status and your tests before you push it, and expect conflicts if the code moved on since the merge.
Further reading: git revert, –mainline (Git documentation)