How to share Code Style settings between developers in IntelliJ

You can create .editorconfig file in Your project (and it can be managed on directory level). More info on https://www.jetbrains.com/help/idea/configuring-code-style.html#editorconfig and https://editorconfig.org/

With this approach You can keep all Your code style settings in one file and it's not limited to IJ only.


The Settings Repository feature was introduced at IntelliJ IDEA 2016.

This option helps us to share IDE settings between different computers, including sharing settings between developers.

The settings are stored at Git repository, for example on GitHub or Bitbucket.

To setup Git repository we should set URL via Settings Repository menu option.

Calling settings

The developer can load remote settings, overwrite remote settings or merge local settings with remote ones.

Set url and choose action

The structure of Git repository with settings:

Git repository structure

I used personal access token for GitHub authentication.


More information:

  • Settings Repository
  • Creating a personal access token for the command line

Code Style can be copied to project and saved in .idea/codeStyles to be shared via version control:

Copy to Project Click this button to create a copy of the current global scheme to the project level. After creating the copy, IntelliJ IDEA suggests to switch to this new scheme at the project level.


I came across this long after the fact, but thought I'd share if anyone ran into this. Add the following to your .gitignore

# IDE - IntelliJ
/.idea/*
# Keep the code styles.
!/.idea/codeStyles
/.idea/codeStyles/*
!/.idea/codeStyles/Project.xml
!/.idea/codeStyles/codeStyleConfig.xml
# Keep the inspection levels
!/.idea/inspectionProfiles
/.idea/inspectionProfiles/*
!/.idea/inspectionProfiles/Project_Default.xml

And of course, make sure your .gitignore also has a ! in front of it so these changes get picked up.

Basically, gitignore's recursive looking is a little wonky, so the below ignores a directory's contents, except for a subdirectory, then ignores that subdirectory's contents, except for the files we want.

codeStyleConfig lets you use per project settings, the project file itself is your actual code styles, and I included the Project_Default as it holds the warning levels, which you likely want if you're doing the code style work anyways.