How to make IntelliJ IDEA insert a new line at every end of file?

How do I make IntelliJ IDEA insert a new line at every end of file, so that GitHub doesn't complain for example?


Change your Editor settings:

Settings → Editor → General → Ensure line feed at file end on Save


For MAC users:

Preferences > Editor > General > Ensure line feed at file end on save


IntelliJ IDEA 2016.3

Approach 1

File > Settings... > Editor > General > Ensure line feed at file end on Save

File > Settings

Editor > General > Ensure

Approach 2

Help > Find Action... (Ctrl+Shift+A) > type "Ensure line feed" > switch the toggle to ON (using the mouse click or Enter) for "Other: Ensure line feed at file end on Save" line

Help > Find Action

Ensure line feed