Remove the last Git commit from remote

Be careful using this, it’s might cause data lose:

git reset HEAD^ # Remove the last commit locally
git push origin +HEAD # force-push the new HEAD commitCode language: Bash (bash)

If you want to still have it in your local repository and only remove it from the remote, then you can use:

git push origin +HEAD^:<name of your branch, most likely 'master'>Code language: Bash (bash)

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.