Set the local branch one revision back (HEAD^ means one revision back):
`git reset --hard HEAD^`
Push the changes to origin:
`git push --force`
# When you accidently commit or do unnecessary commit in the remote
// you can fix this way.
⚠️ Warning: Your commit won't be saved.
#reset the last commit
git reset HEAD^ --hard
#force push the current changes
git push origin --force
# to save your commit
git reset --soft HEAD~1
#stash the changes and then force the changes