Git - how to revert multiple recent commits
Let's assume we have a history like this:
G1 - G2 - G3 - B1 - B2 - B3
Where G1-G3 are 'good' commits and B1-B3 are 'bad' commits and we
want to revert them.
If changes are not pushed to the server yet then the easy way is
to reset the state to previous commit with
git reset --hard HEAD~3.
Here we can refer to
This way the last good commit
But if changes are pushed it is better to use
And here is how to do this for multiple commits:
$ git revert --no-commit HEAD~2^..HEAD