Is there a way to remove unused imports in Intellij IDEA on commit?
It is not very optimal to do it manually, CTRL + ALT + O helps b
When you commit, tick the Optimize imports option on the right. This will become the default until you change it.
Optimize imports
I prefer using the Reformat code option as well.
Reformat code