2.3.3. Local History

Eclipse automatically keeps track of the changes. Changes made few days ago... a few minutes ago. This is stored in a Local History. The changes are stored automatically.

You can control how long you want to keep the changes. And how many changes you want Eclipse to remember. The default preferences for this can be set from Window → Preferences → General → Workspace → Local History. These are the preferences that can be modified:

  • Date to keep files
  • Maximum entries per file
  • Maximum file size (MB)

How to use the local history? You can either compare your source file with local history, or replace it altogether. Right Click on the source file to access the context sensitive menu:

  • Compare With → Local History
  • Replace With → Local History
  • Replace With → Previous from Local History

Let’s change example.c to see this in action. Right click on example.c. Select Compare With → Local History

../../../_images/e-rt-clk-compare-with.png

You will get Local History View. You can see the original file by double clicking on the file. To see the difference against current file, enable compare mode. You can also group revisions by date. Once compare mode is enabled, double click on an entry in Local History View. A sample diff is shown. (See that Eclipse diff is intelligent to find that all changes are only to comparessBound function.

../../../_images/e-local-history-view.png

Local History View

../../../_images/e-history-enable-compare-mode.png

Enable Compare mode in local history

../../../_images/e-compare-view.png

Sample Diff