Hunsu
Hunsu

Reputation: 3381

How to restore files overwritten by git checkout

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?

Upvotes: 1

Views: 156

Answers (1)

Strikeskids
Strikeskids

Reputation: 4052

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.

Upvotes: 1

Related Questions