Which files in .idea folder should be tracked by Git?

After some investigation, I came up with https://github.com/salarmehr/idea-gitignore

#### ignore all .idea files ...
*

#### except

# Version Control configuration for your project
!vcs.xml

# how IDEA should treat the text files in your project
!encodings.xml

# automatic code formatting
!codeStyleSettings.xml

# project specific words
!dictionaries

!copyrights
!misc.xml
!sqldialects.xml

Above files should practically be identical for all team members.


I prefer not to check in the .idea folder or .iml files at all.

  • If you want to share editor styles, consider using a .editorconfig file, the JetBrains IDEs support these now.
  • For other things, like build settings you could try to lean on your build tool, e.g. use maven or gradle build files to carry specific setups.
  • Obviously there's a bunch of other things that won't be covered, but most of them can be solved by well documented conventions.

Jetbrains has some official guidance on which files should not be checked in, and which files should probably not be checked in, depending on your usage. According to that page, you should check in all files in the .idea directory except:

  • workspace.xml
  • tasks.xml

And probably also:

  • the xml files in the dictionary subdirectory

While the particular answer may depend on your team's particular practices, in my experience, following that guidance generally results in correct separation of user settings and shared project configuration.

Some examples of files that should be shared, according to this guidance:

  • ant.xml, which, if you use Ant to build your project, points IDEA to your build files and configures properties that should be used to build.
  • vcs.xml, which specifies the Version Control configuration for your project
  • encodings.xml, which specifies how IDEA should treat the text files in your project
  • modules.xml, which points IDEA to each of your project's module configuration files, which should also be shared in your VCS.
  • all files under the runConfigurations subdirectory, which tells IDEA what it needs to do to run your application
  • codeStyleSettings.xml, which, as you have alluded to, puts your whole team on the same page in terms of automatic code formatting

Depending on your team's usage, there may be more or less, but those are some of the biggest examples.