This command was used to synchronize with the latest state of a remote repo:
git reset --hard origin/develop
Says: throw away all my staged and unstaged changes, forget everything on my current local branch and make it exactly the same as origin/master.
In other words:
A hard reset moves the branch HEAD points to, updates the INDEX and the working tree. It effectively unrolls the last git commit, the last git add command and source file modifications.
$ git log --oneline --decorate 5a4e185 (HEAD, master) V3 bd670b5 V2 1532be9 V1 $ git reset --hard HEAD~ HEAD is now at bd670b5 V2 $ git log --oneline --decorate bd670b5 (HEAD, master) V2 1532be9 V1 $ git status On branch master nothing to commit, working directory clean HEAD V2 INDEX V2 Working tree V2
git reset –hard ... is used, if you really want to override the INDEX and the working tree with some older commit. This way you may loose work because the modification in the working tree are not saved.