Revert changes introduced in old commit
Reverse apply changes from old commit
git checkout <commit-hash>
git log # copy previous commit hash
git diff <previous-commit-hash> > diff.patch
git checkout <main-or-up-to-date-branch>
git apply diff.patch --reverse
Create new commit that revert last commit
git revert <last-commit-hash>