Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

Local History helps us track our local changes for the project and prevents accidentally looses or modifications of the project even outside from the IDE. This tutorial will show how to use Local History to view and revert changes and use labels.

Beware, Local History stores local changes of your project files only for 5 days. Generally it is aimed for development before you put your changes into VCS.

1. Create project from scratch

Create Java project from scratch with name HistoryApp. We will show how to use Local History on example of this project.

2. Create HelloWorldApp class

Create Java class HelloWorldApp. We will try to change this class and see how Local History tracks our changes.

3. Define main method

Now let's define public static main method, which outputs "Hello world!".

4. Show history for file

It seems now we have some changes, so we can check them. Use Local History → Show History action from the context menu in the editor to show the local history of changes for the current file.

Now you see a window with all changes grouped by time. You can select any change and see the difference. You can also revert any changes right here.

5. Add documentation

Add some documentation to our class to make it look finalized.

6. Put label

Since we have a final version of our class, we may put label to the history. Label helps find particular version of file in the history.

To put label use Local History → Put Label action from the context menu in the editor.

Specify any name for your label. We will see how it looks in Local History later.

7. Add comment

Now let's make some change we will revert in the future. Add comment to your output statement.

8. Show history for selection

Now let us see all the changes for selected code. Select the output statement and use Local History → Show History for Selection.

Now you see the changes for selected code only. You may easily find the label we put called "Initial version".

9. Revert changes

Let's say we don't need some change and want to revert our code to the previous version. Use Revert action from the context menu on the version you find appropriate.

10. Show history for folder

All actions we used for a class are also available for a folder. Use Local History → Show History action from the context menu on any folder to see the local history of changes.

Now it shows changed files and folders. You can see actual changes for any file.

  • No labels