Simple answer: git docs
Revert the revert because
So if you think of "revert" as "undo", then you're going to always
miss this part of reverts. Yes, it undoes the data, but no, it doesn't
undo history.
Adding more to it:
Unfortunately, you hit the most popular problem in the history of git users :)
Your problem is a faulty merge git merge branch B/branch A
, which you tried to recover it by git revert
Remember, So a "revert" undoes the data changes, but it's very much not an
"undo" in the sense that it doesn't undo the effects of a commit on
the repository history.
I think the better person to answer this question would be linus torvalds, I can't find the better person than him.
Reverting a regular commit just effectively undoes what that commit
did, and is fairly straightforward. But reverting a merge commit also
undoes the _data_ that the commit changed, but it does absolutely
nothing to the effects on _history_ that the merge had.
So the merge will still exist, and it will still be seen as joining
the two branches together, and future merges will see that merge as
the last shared state - and the revert that reverted the merge brought
in will not affect that at all.
So a "revert" undoes the data changes, but it's very much _not_ an
"undo" in the sense that it doesn't undo the effects of a commit on
the repository history.
So if you think of "revert" as "undo", then you're going to always
miss this part of reverts. Yes, it undoes the data, but no, it doesn't
undo history.
Some of the links solving git revert problem:
Undo a git merge (hasn't been pushed yet)
git revert, reset and merge problems