Remove a git commit which has not been pushed

IF you have NOT pushed your changes to remote

git reset HEAD~1

Check if the working copy is clean by git status.

ELSE you have pushed your changes to remote

git revert HEAD

This command will revert/remove the local commits/change and then you can push

Source: https://stackoverflow.com/questions/1611215/remove-a-git-commit-which-has-not-been-pushed

Leave a Comment