What files in the .idea folder should I track with Git?

Unlike Netbeans, in the Jetbrains IDE, the configuration files associated with the user and the team are mixed in one folder, which makes it difficult when you need to click them on git.

There are a number of git ignore examples for these IDEs and https://intellij-support.jetbrains.com/hc/articles/206544839 pages on the git website.

However, after using them for several months, we find out that it is safer and actually more convenient to do the opposite. I mean ignore all .idea files and explicitly add only the settings related to the command. (instead of adding all and ignoring some).

The main thing that can be shared between developers is the code style configuration. Thus, using the option of automatic reformatting of the IDE, the entire team will adhere to a consistent style.

Also, the question is, which other files are being renewed to be included, were not ignored? What for?

Answer: I came up with this: https://github.com/salarmehr/idea-gitignore

+13
git intellij-idea ignore phpstorm
source share
5 answers

After some investigation, I came up with the following .idea/.gitignore :

 # ignore all .idea files ... * # except ... # Version Control configuration !vcs.xml # how IDEA should treat the text files !encodings.xml # automatic code formatting !codeStyleSettings.xml # project specific words !dictionaries !copyrights !misc.xml !sqldialects.xml 

The above files should be almost the same for all team members.

Answer: I came up with this: https://github.com/salarmehr/idea-gitignore

+4
source share

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

  • workspace.xml
  • tasks.xml

And perhaps also:

  • xml files in dictionary subdirectory

Although the specific answer may depend on your specific practice of your team, in my experience, following this guide usually leads to the correct separation of user settings and the overall configuration of the project.

Some examples of files that should be split, according to this guide:

  • ant.xml , which, if you use Ant to create your project, points IDEA to your build files and sets the properties that should be used for the build.
  • vcs.xml that indicates the version control configuration for your project
  • encodings.xml , which indicates how IDEA should process text files in your project.
  • modules.xml , which IDEA points to each of the configuration files for your project module, which should also be used in your VCS.
  • all files in the runConfigurations subdirectory that tell IDEA what it needs to do to run your application
  • codeStyleSettings.xml , which, as you indicated, puts your entire team on the same page in terms of automatically formatting the code.

Depending on the use of your command, there may be more or less, but these are some of the biggest examples.

+13
source share

I prefer not to check .idea or .iml at all.

  • If you want to share editor styles, consider using a .editorconfig file .editorconfig JetBrains IDEs now support them.
  • For other things, such as build settings, you can try to rely on your build tool, for example. use maven or gradle build files to transfer specific settings.
  • Obviously, there are many other things that will not be covered, but most of them can be resolved by well-documented conventions.
+2
source share

It is recommended that you do not .idea entire .idea folder, as it is intended for configurations. Like a *.iml file.

If I use Netbeans instead of Intellij, I do not want these configuration files. This is useless and can be a little dangerous for conflicts.

+1
source share

I use both IDEA and Eclipse, but not Netbeans. I never take any project files on myself, but I make sure that I have the Maven assembly as a leading tool, then I can easily import the Maven project into any Maven-enabled IDE, and also update from Maven after changing it, For Eclipse and IDEA this works great.

My .gitignore file looks like this for all my projects:

 # Eclipse .settings/ .classpath .project # IntelliJ IDEA .idea/ *.iml # Maven target/ 

Plus other project-related files or directories.

+1
source share