1

It just happened that while trying to remove the byte-compiled files from my .emacs.d directory. I ended up deleting up all the source files i.e .el files. It was a find remove, i.e I ran find . -name "*.el" -exec rm {} \;. The .emacs.d directory was under git version control. But from a long time there was no commits. I have tried few suggestions from stackoverflow.com but that too didn't help. What I tried is as below

git checkout -- .
git reset --hard

both the commands didn't work and I still do not see my files.

any suggestions would be more than welcome. Please assist.

Squidly
  • 2,707
  • 19
  • 43
OmPS
  • 331
  • 3
  • 12
  • What happen if you try to clone the repo again (in a new local directory)? Would you see the `el` files then? – VonC May 17 '15 at 14:44
  • So they might not have been versioned (or at least not committed). Were there some .gitignore files excluding *.el files? Or were they (the el files) simply added to the index (git add) but not committed? – VonC May 17 '15 at 14:46
  • git ls-files -d | xargs git checkout -- – Donal May 17 '15 at 14:47
  • Also http://stackoverflow.com/a/14988152/6309 `git fsck --lost-found | grep blob | awk '{print $3}'` – VonC May 17 '15 at 14:48
  • 1
    "But from a long time there was no commits." Does that mean that you changed but didn't commit changes for a long time or you did't change at all? – Nick Volynkin May 17 '15 at 15:31

1 Answers1

0

If git reset --hard leaves you with a clean working tree, probably such tree was saved in one of the latest commits.

First to do: what's in the repo history?

git log --oneline --decorate --graph --all

Second: if there was a git reset --hard with data loss, try running git reflog.

Nick Volynkin
  • 14,023
  • 6
  • 43
  • 67