How to share Code Style settings between developer

2019-02-01 03:44发布

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.

2条回答
够拽才男人
2楼-- · 2019-02-01 04:12

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:

查看更多
ゆ 、 Hurt°
3楼-- · 2019-02-01 04:29

Code Style can be copied to project and saved in .idea/codeStyleSettings.xml 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.

查看更多
登录 后发表回答