cancel a commit not pushed
git reset --soft HEAD~
git remove commits from branch after push
git reset --hard <last_working_commit_id>
So we must not reset to the commit_id that we don't want.
Then sure, we must push to remote branch:
git push --force
delete a pushed commit
# delete the last commit
$git reset –hard HEAD~
git delete last commit in remote
1
$git rebase -i HEAD~2
git delete pushed commit
git reset --hard <last_working_commit_id>
git push --force
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us