Search code examples
javaeclipserevision-history

Eclipse - Java local history for file


Eclipse local history support a file

Every time an editable file is saved in the Workbench, the Workbench updates the local history of that file and logs the changes that have been made. The local history of a file can then be accessed and a previously saved copy of the file can be reverted to, as long as the desired state is recent enough in the save history.

But in Java it seems to limit to Java type as method

Whenever you edit a file, its previous contents are kept in the local history. Java tooling makes the local history available for Java elements, so you can revert back to a previous edition of a single method instead of the full file.

When try to get file history I get a popup error with Please local history select a type, method or field

How can I get history of my java file in eclipse? Is it enhancement or is there a workaround to see previous version of file

  • Note for example if method signature changed I can't see previous method in history

Solution

  • The full replace / compare options are available in the context menu in the Package Explorer and Project Explorer views.

    Right click on the Java file and select 'Replace With > Local History....' or 'Compare With > Local History...'

    Also note that you can control the amount of Local History that Eclipse keeps in the Preferences on the 'General > Workspace > Local History' page.