While issuing git revert <commit_hash> command i am getting error message as below:-
$ git revert e8801f7
error: commit e8801f7f3b800fee035693aa6bfd12868c15eec9 is a merge but no -m option was given.
fatal: revert failed
What value should i give to -m switch of git revert?
-m switch is given to git revert command to tell Git to which parent commit the changes should be reverted back to. -m switch is not required when reverting a normal (non-merge) commit. It is required only while reverting a merge commit.
Follow the example below to understand the use of -m switch. Below is the git log of a recent merge commit that was created after resolving a conflict:-

Now:-
To revert back to parent 1 commit give below command:-
git revert -m 1 79f06e5
To revert back to parent 2 commit give below command:-
git revert -m 2 79f06e5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With