Git UndoLesson 34Free preview
Git Revert
This lesson is part of Git · All levels
Summary
Git revert cancels the effect of a commit by creating a new commit that contains the reverse of the change. Since the history is not deleted, this method is safe for commits that have been published and used together. Reversing the merge commit requires a parent designation because the merge commit has two parents.
Key points
- Revert makes a new substitute commit, not erase history
- Safe to use on commits that have been pushed to the shared remote
- Git revert <hash> cancels the commit change
- Revert merge commit requires -m <nomor-parent>
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.