If you made
git reset --hard by mistake, possibilities are you can still get your commit back, as git holds a log of everything for a few days. This is only valid if your work is backed up, i.e., by committed or stashed. As
git reset --hard removes uncommitted changes, so be careful before going into trouble.
The much more reliable choice is to run the following command.
git reset --keep
Alternatively, you can check the list of your past commits and choose the SHA of the commit you want:
Now, run the following command to get your changes back:
Originally Posted On: Github (k88hudson)
git reset --hard SHA1234