2 ms·
Reverting a merge commit is the big danger zone. Let's say you are working on a feature branch and you accidentally commit it to the upstream branch before you
by bkeroack 12y ago
Reverting a merge commit is the big danger zone.
Let's say you are working on a feature branch and you accidentally commit it to the upstream branch before you're ready. Intuitively, you might then revert the merge changeset, continue working on your feature branch for a while, and then when you're done, merge it back upstream.
That would be wrong.
What will actually happen is that when you do the second merge, only the changes you made after the reverted merge will be applied to the upstream branch. All the work that was "reverted" in the initial mistaken merge will be missing, even after the second merge! This can be very confusing, since there's no indication to the developer where it went. It's just gone.
The fix at that point it to revert the revert changeset. But the real solution is to never revert a merge.