Git revert command

The git revert creates a brand-new commit which reverses/undoes the changes from the specified commit(s), but keep that(those) commit(s) in the branch. Because it results in a new commit, we will be prompted to enter a commit message.

git revert <commit-hash>

We can use the git log command to see the commit hash.

We have many options which we can use with git revert:
a) -e: It is used to edit the commit message before reverting the commit. It is a default option in git revert command.

git revert -e <commit-hash>

b) --no-edit: With this option, git revert will not start the commit message editor.

git revert --no-edit <commit-hash>