## Local history

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.

1. Create a new file named sampleFile.txt.

2. In the editor for sampleFile.txt modify the resource by adding the line "change1" and saving the file.

3. Repeat this by entering a new line "change2" and saving it again.
4. Add a third line "change3" and save it again.

5. From the resource's context menu in the Navigator view, select Replace With > Local History.

6. The Replace from Local History dialog opens and shows the previous local history of the file.

   The left pane of the dialog contains the Workbench's copy of the file. The figure above shows that the Workbench contains the copy with all 3 lines - the same copy that is currently shown in the editor area of the Workbench.

   The first item in the local history (see above) contains the last saved copy of the file. This is the one with only two lines of text. The final entry in the tree is the first copy of the file.

   The bottom area of the dialog displays the differences between the Workbench file and the specific copy of the file selected in the local history.

7. Select the first item (shown above) in the local history. The right pane should show one line of text.

8. Click Replace. This replaces the Workbench's copy of sampleFile.txt with the chosen local history item.

9. Observe that the sampleFile.txt editor now contains two lines.