IntelliJ IDEA 2017.3 Help

Saving and Reverting Changes

When working with IntelliJ IDEA, you don't need to worry about saving changed files: all changes are auto saved.

Unwanted changes can be undone at any stage of your development workflow. Any file or directory can be reverted to any of the previous states.

When does IntelliJ IDEA auto save changed files?

Autosave is initiated by:

  • Compiling a project, a module or a class
  • Starting a run/debug configuration
  • Performing a version control operation such as pull, commit, push, etc.
  • Closing a file in the editor
  • Closing a project
  • Quitting the IDE

In fact, there is a lot more autosave triggers, and only the most important ones are mentioned above.

Tuning the autosave behavior

The following options are available for tuning the autosave behavior (File | Settings | Appearance and Behavior | System Settings/ (IntelliJ IDEA | Preferences | Appearance and Behavior | System Settings):

  • Save files on frame deactivation (i.e. on switching from IntelliJ IDEA to a different application).
  • Save files automatically if application is idle for N seconds.

Note that those are optional autosave triggers, and you cannot turn off autosave completely.

Using the Save All command

If necessary, you can initiate saving all changed files yourself. There is the Save All command for that:

  • File | Save All
  • Ctrl+S

Marking files with unsaved changes in the editor

Changed but yet unsaved files can be marked. For this purpose, there is the Mark modified tabs with asterisk option (File | Settings | Editor | General | Editor Tabs/ IntelliJ IDEA | Preferences | Editor | General | Editor Tabs).

When this option is on, the files with unsaved changes have an asterisk asterisk marker on their editor tabs.

asterisk marker in editor

Saving a file under a different name

There is no File | Save As command in IntelliJ IDEA. To save a file under a different name or in a different directory, use Refactor | Copy or F5.

Reverting changes

You can undo changes by using Edit | Undo or Ctrl+Z. To revert files to their previous states, use Local History and the corresponding version control functionality.

Last modified: 6 March 2018

See Also