At one point or another you are going to make a commit that you will regret afterward. Maybe it is a bad merge. Or maybe it is some animation that just brakes half of your screen layout at the end yet you notice it two days later, as well as 10 commits later.
But what if I told you you can revert that commit?
Git has a simple command that is going to try to revert changes you made and then make a new commit. All you have to do is provide the number of the commit if you count away from the
git revert HEAD
Similarly, in case you want to revert commit before the last one, then that one is going to have a number
git revert HEAD~1
As a result we will see a new commit that has reverted the changes from the commit we have specified.
In case you are lucky then you will have no merge conflicts to deal with.