When something like that happens to me (very rarely) I can only think of git reflog
which is a commit history of all your git commands.
So if you want to go back in time in a given git operation you can
$ git reflog
794e18b HEAD@{0}: commit (merge): Fixed conflicts
f9b382a HEAD@{1}: commit: Some minor errors on the file
1dc6496 HEAD@{2}: commit (amend): provisional tables for
92f06d1 HEAD@{3}: commit (amend): provisional tables for
a97a3a8 HEAD@{4}: commit: provisional tables for
6ed9ebf HEAD@{5}: commit: @user changes.
8e79234 HEAD@{6}: commit: Changed the billboard and tables.sql
486acf6 HEAD@{7}: rebase -i (finish): returning to refs/heads/master
486acf6 HEAD@{8}: rebase -i (pick): Fixing some hal issues
e6d6e1a HEAD@{9}: rebase -i (pick): simple table definitions.
Now if I want to go back to let's say the a97a3a8 HEAD@{4}: commit: provisional tables for
I just do
git reset --hard HEAD@{4}
Hope this saves your file :)