33.38 Git Revert Merge

20211108

Ooops. In dealing with a couple of pull requests into the main branch of the repo, and then trying to merge main into a development branch to update that branch, somehow the development branch got merged back into main along the way and committed. Now main in the repo is broken!

We can revert from a merge using revert. First, grab it’s commit hash (SHA1), and then:

git revert -m 1 14ce095395f254394193a83cef542984202590fd

The -m 1 ensures that we keep the parent side of the merge of the branch we are merging into.

If there are any conflicts then manually resolve them and then git add to mark the conflict as resolved.

Once all that is done we have a buch of changes ready to commit to revert the previous merge.



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0