Answers for "git soft reset and hard reset"


git reset hard

$ git reset --hard HEAD       (going back to HEAD)

$ git reset --hard HEAD^      (going back to the commit before HEAD)
$ git reset --hard HEAD~1     (equivalent to "^")

$ git reset --hard HEAD~2     (going back two commits before HEAD)
Posted by: Guest on June-16-2021

git soft reset head

git reset --soft HEAD^
//resets head by 1
Posted by: Guest on August-13-2020

Browse Popular Code Answers by Language