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 every saved file ends with a line break
Settings
Editor
General
Ensure every saved file ends with a line break