Eclipse reverting java file to a much older versio

2019-08-06 01:50发布

I have no idea how this happened but right after re-factoring a variable name (a final static int), the file showed a much earlier version of the same file without any ability to restore back all the hours of work I put in.

This looks like a bug to me or... "undocumented feature" (i.e. unfortunate key-combination that erases hours of work, even if stored on file)?

Has anyone experienced this?

Is this a well known behavior of Eclipse?

标签: eclipse
1条回答
狗以群分
2楼-- · 2019-08-06 02:26

Recovering work from Local History

Try recovering the lost work by using the 'Local History' feature of Eclipse.

Right click on a file and click on Compare With -> Local History... like so :

Local History

Once you do that, you should see a History view with timestamped entries like so :

enter image description here

Double clicking on those should allow you to go to a specific version of the File. You should be able to recover your work if you go to timestamped entry just before the apocalyptic refactoring.

For more details see this Eclipse help page.

Local History Preferences

This feature can be most useful to get back work which otherwise would be lost. In order to increase the amount of history per file (Maximum Entries per file) and the longevity of this history (Days to keep Files), try increasing the default values by going to Preferences -> Workspace -> Local History :

enter image description here

查看更多
登录 后发表回答