Disabling random git merge without history regression

I did something stupid and accidentally merged the topic thread into my lead thread and then pushed it to github (where others pulled). To make sure this was a complete error, I pulled it onto my production servers.

I hung in my voice for enough time, and now I need to figure out how to effectively roll back the code when committing commit history.

To get my product code in the correct order, I ran git checkout hashoflettersandnumbers and that commit I want HEAD to be.

I run git reset hashoflettersandnumbers and then git clean to remove the changes from this commit going forward, but I cannot force this code to be HEAD of the master branch and make a new commit.

+6
source share
1 answer

Use git revert for each branch. This will create a new commit that will keep your mistake for all eternity, but will return to you the same tree as before you merged.

For example, if 123456 is a merge commit ...

 $ git checkout master $ git revert 123456 $ git checkout topic-branch $ git revert 123456 

This suggests that this was not an “accelerated” merger.

+5
source

Source: https://habr.com/ru/post/888248/


All Articles