How to deal with IntelliJ IDEA project files under Git source control constantly changing?
Solution 1:
You can use IDEA's directory-based project structure, where the settings are stored in .idea directory instead of .ipr file. It gives more fine-grained control over what is stored in version control. The .iml files will still be around, so it doesn't solve the random changes in them (maybe keep them out of source control?), but sharing things such as code style and inspection profiles is easy, since each of them will be in its own file under the .idea directory.
Solution 2:
From official DOC: http://devnet.jetbrains.com/docs/DOC-1186
Depending on the IntelliJ IDEA project format (.ipr file based or .idea directory based), you should put the following IntelliJ IDEA project files under the version control:
.ipr file based format
Share the project .ipr file and and all the .iml module files, don't share the .iws file as it stores user specific settings.
.idea directory based format
Share all the files under .idea directory in the project root except the workspace.xml and tasks.xml files which store user specific settings, also share all the .iml module files.
I put it in my .gitignore:
#Project
workspace.xml
tasks.xml