git remove commit
# Removes latest commit from the stash, KEEPS changes
git reset --soft HEAD~
# Removes latest commit from the stash, DELETES changes
git reset --hard HEAD~
git remove commit
# Removes latest commit from the stash, KEEPS changes
git reset --soft HEAD~
# Removes latest commit from the stash, DELETES changes
git reset --hard HEAD~
erase commit from git repo
git reset <reference_to_commit> #default flag --mixed
#Commits are reference with the HEAD~ not SHA.
#HEAD~1 is the 2nd commit, HEAD~2 is the 3rd commit, HEAD~3 is 4th commit....
#NB: Be aware of the active branch.
git reset --mixed HEAD~<reference_no.> #Moves HEAD to the referenced commit,
# and moves commits before it to the working directory.
git reset --soft HEAD~<reference_no.> # Moves HEAD to the referenced commit,
# and moves commit before it to the staging index.
git reset --hard HEAD~<reference_no.> #Moves HEAD to the referenced commit,
# and moves commits before it to the trash and erased from tree.
#NB: All commits that are reset are kept in the trash for 30days.
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