The git revert
command is used to undo changes to a repositorys commit history by creating a new commit that is the opposite of an existing commit. It is used when you want to apply the inverse of a commit from your project history, for example, if youre tracking down a bug and find that it was introduced by a single commit. Unlike git reset
, which allows you to go back to a previous commit, removing any other commits on its way back, git revert
only removes a specific commit and does not change the project history. When you revert a commit, the changes from the targeted commit are removed from your local workspace, and a new commit is created to reflect the new state of your repository. The git revert
command can be used with various options, such as -e
to edit the commit message prior to committing the revert, -m parent-number
to revert a merge commit, and --no-edit
to skip the commit message editor.
what does git revert do
