You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
nikkischnelle edited this page Nov 8, 2024
·
1 revision
Reverting a Merge Commit --- DO NOT DO THIS
Example:
git log:
This shows the merge commit at the very top.
It has two parents that are seen after Merge:8ca1a75 and c6764a3
We can see right below, that the current main (which was the merged branch) points to commit c6764a3e34a4c9f41052ebe1396fc7ec6c34fd0a
We're looking for the commit that our branch pointed to before the merge. So if we compare the commit hashes, for us it's the first hash.
git reset --hard 8ca1a75 thus resets our local HEAD back to the commit before the merge.