While attempting to revert a commit which is not the latest on my branch, I have run into this message:
error: commit fce9354*** is a merge but no -m option was given.
fatal: revert failed
Here is the git log of the branch just before the revert attempt:
C:\git\manager [feature/revert]> gl -n15 --oneline
a81945f (HEAD -> feature/revert, origin/develop, develop) Merge branch 'develop' of https://xyz/manager into develop
60cf3e5 Merge branch '***' into develop
b94fc85 Merge branch '***' into develop
9d81bc6 (origin/***) Accept
48b318d (origin/***) Accept
6f57592 ***
d823f1f (origin/***) removed
854887b *** merged
0ebef20 added
fce9354 Merged PR 12345: Add
90f2b0f (origin/***) Add
c859184 Merge branch '***' into develop
a1afdb3 Change
fb48628 added
2641680 added
C:\git\manager [feature/revert]> git revert fce9354
error: commit fce9354*** is a merge but no -m option was given.
fatal: revert failed
I understand that a revert is essentially a new commit created to undo a previous commit.
The git revert documentation for the -m flag states:
Usually you cannot revert a merge because you do not know which side of the merge should be considered the mainline. This option specifies the parent number (starting from 1) of the mainline and allows revert to reverse the change relative to the specified parent.
How can I find the value I should be providing to the -m flag?
I only want to remove the commit which represents the merge of the branch into the develop branch so that I can fix the branch and create a later merge which introduces everything on the branch back into develop. ie: I do not want to prevent previous changes on the branch from being merged into develop later.
Is there a simpler way to undo the changes of a previous commit?