# KEEP CHANGES
git reset --soft HEAD~1
# REMOVE CHANGES
git reset --hard HEAD~1
# Uncommit the changes
git reset --soft HEAD~1
# Completely delete the changes
git reset --hard HEAD~1
# Reset the index and working tree to the desired tree
# Ensure you have no uncommitted changes that you want to keep
git reset --hard 56e05fced
# Move the branch pointer back to the previous HEAD
git reset --soft HEAD@{1}
git commit -m "Reverting to the state of the project at f414f31"
git revert <the_commit_hash>
git revert <commit hash>
git revert
$ git reset HEAD^
$ git revert HEAD
git reset 'HEAD@{1}'
$ git revert [here comes the commit id]
-Note that this operation creates a new commit that reverts
all of the changes instead of removing given commit from history.
git reset <commitId>
# Exemple
git reset 5310517
$ git log --oneline
b764644 File with three lines
7c709f0 File with two lines
9ef9173 File with one line
$ git log --oneline
9ef9173 File with one line
git checkout <commit hash>
Reset Git COmmit
git reset --hard <sha1 of desired commit>