'if you accidentally merged your branch with staging, will reverting it damage the history

i pushed a branch to the main, instead of staging, and then i reverted this change.

Has this left any lasting effects such as changed the history or are all negative effects removed?

git


Solution 1:[1]

Has this left any lasting effects

Yes. A git revert of a merge commit changes the state but not the topology (history). Thus, although the main branch looks correct as to its current state, your branch's commits now cannot be merged into main ever again in future, because they are still part of main's history. That may or may not be a problem; it all depends.

(This is the problem so well discussed at https://github.com/git/git/blob/master/Documentation/howto/revert-a-faulty-merge.txt).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 chepner