Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Delete commits from a branch in Git
#### Delete the last commit
For example your last commit
git push origin +aa61ab32^:master
Now you want to delete this commit then an Easy way to do this following
First reset the branch to the parent of the current commit
Force-push it to the remote.
git reset HEAD^ --hard
git push origin -f
For particular commit, you want to reset is following
git reset bb676878^ --hard
git push origin -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment