Undo a commit with a new commit
low risk
Applies the inverse of a commit — safe for shared branches.
| Flag | Meaning |
|---|---|
-n | No commit |
-m | Mainline for merge commits |
git revert HEADUndo the last commit safely · explain & risk-check →Reference text is hand-written and may be incomplete — check man git for your version. Test destructive commands on a non-production system first.