You pushed a bad commit. You can't rewrite history (others are building on it). git revert creates a new commit that undoes the bad one — safely.
git reset erases
history — dangerous if you've already pushed.
git revert adds
a new commit that is the exact opposite of the bad one.
History stays intact, but the damage is undone.
Safe for shared branches. Everyone sees the fix
without confusion.
The bad commits are still in history (for the record),
but their effects are completely undone by the revert commits.
No rewriting, no confusion.
This is the safest way to undo mistakes on shared branches.