Shell/Bash: git reset to commit Example


Shell/Bash Example: This is the "git reset to commit" Example. compiled from many sources on the internet by

git reset to commit

# reset to specefic commit
git reset --hard 

# to go back one step 
git reset --hard HEAD~1

# note: use --soft to keep file changes

git reset head of master

git fetch origin
git reset --hard origin/master

git reset last commit

$ git reset --soft HEAD~1

git soft reset head

git reset --soft HEAD^
//resets head by 1

how to revert a commit

git reset --soft [email protected]{1} # delete the last commit keeping the changes
git reset --hard [email protected]{1} # delete the last commit removing the changes

git push --force origin master # delete the last commit also on remote branch

git reset head

sudo git reset --hard Head

* Summary: This "git reset to commit" Shell/Bash Example is compiled from the internet. If you have any questions, please leave a comment. Thank you!