1 min read
Delete the last N commits locally and in the remote

If you want to remove the 2 (two) last commits, you can use the git reset command with hard mode:

git reset --hard HEAD~2

You can change the 2 for any number of last commits you want to remove

To push this change to remote, you need to do a git push with the force (-f) parameter:

git push -f

ref: https://git-scm.com/docs/git-reset