Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

9
  • 4
    This is actually a very good tip, saved me a lot of times ;) And its way simpler than doing anything in git...
    – severin
    Commented May 21, 2012 at 15:30
  • 16
    This is the only way to recover unstaged changes in files after the hard reset. Saved me too ;) Commented May 30, 2013 at 20:33
  • 5
    As an additional hint, some IDEs as eclipse also have the recent file history saved. That way, you might even be able to recover older changes after the editor was closed. That worked wonders for me.
    – martin
    Commented Aug 15, 2014 at 9:48
  • This saved me today. Not major changes but still I was tired after lot of experimentation and made a thing worked until I messed up. I wonder if there is no "git" way of doing it! Reflog takes only to the commit, sad though. And I am using eclipse which doesn't save history if I close the IDE. But for a particular file, I opened that IDE and that was the major file to be done in my local changes. :P Commented Dec 6, 2016 at 22:22
  • 2
    Nice, good suggestion, in the case of IntelliJ family (e.g. PhpStorm, WebStorm, RubyMine, PyCharm) you can right click a filename and choose "local history > show history" and also recover that way as well. Assuming the IDE was open and tracking local changes. Commented Apr 9, 2019 at 23:24