git reset –hard HEAD^
git status
emergency save (if something went wrong during commit and all the local changes were lost):
git show -p –format=raw $blob > $blob.txt
Also, read this: http://gitready.com/advanced/2009/01/17/restoring-lost-commits.html
git reflog
39ba87b… HEAD@{0}: HEAD~1: updating HEAD
7c61179… HEAD@{1}: pull origin master: Fast forward
[... lots of other refs ...]
$ git merge 7c61179
Updating 39ba87b..7c61179
Fast forward
css/screen.css | 4 ++++
submit.html | 4 ++–
2 files changed, 6 insertions(+), 2 deletions(-)
If you see 1 commit ahead … run git satus, open all edit files, run git reset –hard HEAD^, until you see
“Your branch is behind ‘fedevel/jethro’ by 1 commit, and can be fast-forwarded.”
Then git pull
re-save all the edited open files again.