1

I was working on my project (eclipse project with egit plugin) and I accidentally removed a file. I haven't committed the changes. I wanted to restore the file so I did:

git checkout commit src

Now my source files are replaced by those of my previous commit.

Is there any chance to restore the changes I have made? If yes how to do it?

Hunsu
  • 3,281
  • 7
  • 29
  • 64
  • http://stackoverflow.com/questions/6624036/restore-file-from-old-commit-in-git/6624085 These answers may help you. – reeco Jul 04 '14 at 14:41
  • No it's not a duplicate of that question. I haven't commit my changes! – Hunsu Jul 04 '14 at 14:54
  • I don't think there is a way to get your changes back. That is why you should be careful while checking out a file. Hard luck bro :( – Rohit Jain Jul 04 '14 at 15:04

1 Answers1

1

Try checking out eclipse local history. Your file changes still should be there, even if you reverted them using git checkout.

Edit: You are out of luck. If you checked out over top of your changes, then you have lost them. Next time I would recommend trying git stash before checking out over your changes. That way you will be able to pop them off the stash.

Strikeskids
  • 3,932
  • 13
  • 27