| 36 | Reverting Commits |
Sometimes we make mistakes. A commit that wasn’t supposed to be
shared gets pushed to a public repository, a commit has a bug that
can’t be fixed and needs to be undone, or maybe you just don’t need
that code any longer. These cases all call for git
revert.
The git revert command does just what
you might expect. It reverts a single commit by applying a reverse
commit to the history.
You can call git revert with just a
commit ID. Git launches the editor with the commit message already
filled out. It follows this pattern:
Revert "some commit message" |
|
|
|
This reverts commit <some commit hash>. |
You can edit this message to be whatever you want. You can use the
--no-edit parameter to tell ...