Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse's local history...where are files saved?

People also ask

Where do Eclipse files saved?

- [Voiceover] When we first installed Eclipse, and we launched it for the first time, do you remember the prompt that it asked you where you wanted to store your files? It automatically defaults to the C drive, to users, your username, and it creates a folder called Workspace. That's where your files are located.

Can you see the history of Java file?

Right-click a file or folder in the project and click Show History. In the Change Explorer view, open a change set, right-click a file or folder in the change set, and select Show History.

How do I view Eclipse history?

Right Click on the file and select "Compare With" > "Local History" . It will list the file history by date. Click on any date will display the history of the file content with current version.


To complete CurtainDog's answer: from eclipse FAQ

Every time you modify a file in Eclipse, a copy of the old contents is kept in the local history. At any time, you can compare or replace a file with any older version from the history.
Although this is no replacement for a real code repository, it can help you out when you change or delete a file by accident.
Local history also has an advantage that it wasn’t really designed for: The history can also help you out when your workspace has a catastrophic problem or if you get disk errors that corrupt your workspace files.
As a last resort, you can manually browse the local history folder to find copies of the files you lost, which is a bit like using Google’s cache to browse Web pages that no longer exist.

Each file revision is stored in a separate file with a random file name inside the history folder. The path of the history folder inside your workspace is

.metadata/.plugins/org.eclipse.core.resources/.history/

You can use your operating system’s search tool to locate the files you are looking for.


Note, if your need to import your local history into a new workspace, you will need both:

  • .metadata/.plugins/org.eclipse.core.resources/.history
  • .metadata/.plugins/org.eclipse.core.resources/.project

to have a functional local history in that new workspace.


Try right-clicking on the file in eclipse, and choose Replace With->Local History.

If there's history available, it'll show up as a list of edit times.

But more importantly, as pointed out in other answers, be sure to put your files in version control! SVN is pretty easy to set up (you don't need a server; it can just use the file system); use it even if you aren't sharing with others.

A tip: whenever you hear yourself say "yes!", check in all of your code. 10 minutes later, you'll be saying "how did I mess that up?"


If you have lost a full package structure due to accidental deletion or svn/cvs override, select the project> right click> Restore from local history => select the files.


VonC's answer has all the information you need for finding the location of your code backups. I would simply add that if you are on a Mac or Linux, you can do something like this:

$ cd [WORKSPACE]/.metadata/.plugins/org.eclipse.core.resources/.history/
$ grep -rl "class Foo" . | xargs ls -lt

This will find all the versions of a file that contains a particular string (ie. "class Foo"), and sort them by date/time to easily find the most recent version.


You can use the link http://wiki.eclipse.org/FAQ_Where_is_the_workspace_local_history_stored%3F is very helpfull