0

I doubt git keeps this in memory, but perhaps I missed an option.

I modified a file on my local repository, and then I did git rm file. I would like to restore file in its previous state, ie. my local modified copy. git checkout file will restore it to the latest versionned state, losing my changes... If there still a way to recover my changes?

bagage
  • 1,094
  • 1
  • 21
  • 44
  • Did you use an IDE like Eclipse or other, which may have an local version history? (http://www.aaronwest.net/blog/index.cfm/2007/3/23/Do-You-Know-About-Eclipses-Local-History and http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2FgettingStarted%2Fqs-55.htm) – VonC Mar 04 '15 at 10:29
  • I'm using sublime text, and since I closed the file it seems no history is kept :( – bagage Mar 04 '15 at 10:33
  • Did git not warn you with an "Error: the file has local modifications" message? – Noufal Ibrahim Mar 04 '15 at 10:43
  • 2
    @squiroid Suggesting `reset --hard` right away without explaining the impliciations of the command is really, really dangerous. Furthermore you can use `git checkout -- path/to/file` to checkout the latest version of a specific file. – Sascha Wolf Mar 04 '15 at 11:05
  • Sorry for that my bad :-( . – squiroid Mar 04 '15 at 11:10

1 Answers1

1

Like mentioned here there is no option to restore untracked changes except through an external tool. Sorry :/

Community
  • 1
  • 1
Jan
  • 1,004
  • 6
  • 23