Best practice for developing using Spark
What you want to do is develop your code in IntelliJ, and then package your code and dependencies into an executable jar file using SBT or Maven. 

When you have your jar stored locally, you can use spark-submit to transfer the jar to your cluster (along with some other parameters) for execution.

You might also want to take a sample of your data and store it locally so you can run spark locally and test/debug your code in IntelliJ. This can speed up development considerably, and having access to a debugger is a huge help.