In this tutorial, we are going to learn about how to undo a git merge to a previous commit with the help of examples.
Consider we have a two branches
test in our repository then we added a new commit to the
test branch and merged it to a
After some time we find errors in the merged branch and undoing the
Navigate to the merged branch inside the command line.
git resetcommand followed by the
git reset --hard ORIG_HEAD
This above command will undo the
git merge to a previous commit.
ORIG_HEADis referencing to the previous commit before the merge.