Find the commit hash you want to go back to by git log --oneline
and then
git reset <commit_hash>
git reset
without a --hard
or --soft
moves your HEAD to point to the specified commit, without changing any files.
Now you have the latest changes uncommited which you need to add and commit again.
If the commit was pushed, you can then do git push -f