I would like all developers on my team to use the same default code style settings. We all use IntelliJ 11+ as our IDE and we use git as our source control system.
What is the easiest way to make sure they're all using the same settings? I thought there would be a way to check in the style settings into the project and have their editors discover them automatically, but that doesn't seem to be the case.
PS. I don't mind if developers consciously override some of the default settings with their own preferences, but I do want to make sure that we all at least start from a common set of default settings.
and select Enable Sync. Alternatively, select File | Manage IDE Settings | Sync Settings to JetBrains Account from the main menu. In the dialog that opens, click the Enable Settings Sync button. Your local settings will be exported to the JetBrains repository linked to your account.
Choose File | Manage IDE Settings | Export Settings from the main menu. In the Export Settings dialog that opens specify the settings to export by selecting the checkboxes next to them.
In the editor, select a code fragment you want to reformat. Before reformatting, you can take a look at the code style settings that are applied to the selected code: press Alt+Enter and click Adjust code style settings. From the main menu, select Code | Reformat Code or press Ctrl+Alt+L .
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.
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.
The developer can load remote settings, overwrite remote settings or merge local settings with remote ones.
The structure of Git repository with settings:
I used personal access token for GitHub authentication.
More information:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With