What is git revert?
git revert undoes the changes of a previous commit by adding a new commit that does the opposite. The old commit stays in the history, so nothing is rewritten.
git revert HEAD
git revert <commit-hash>
This is the safe way to undo a commit which is already pushed, because other people’s history is not affected. Compare with git reset, which moves the branch back and removes commits. See Git Revert.
Learn more about the similar topics:
| Tutorials |
|---|
| Git Restore |
| Git Commit Amend |
| Git Reset |
| Git Revert |
| Git Stash |
| Git Reflog |