Git Recovering from a lost commit


Example

In case you have reverted back to a past commit and lost a newer commit you can recover the lost commit by running

git reflog

Then find your lost commit, and reset back to it by doing

git reset HEAD --hard <sha1-of-commit>