Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Forbidden Section

nikkischnelle edited this page Nov 8, 2024 · 1 revision

Reverting a Merge Commit --- DO NOT DO THIS

Example:

git log: image

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.

Clone this wiki locally