Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA 9/10, what folders to check into (or not check into) source control?

People also ask

What is source folder in IntelliJ?

Content in IntelliJ IDEA is a group of files that contain your source code, build scripts, tests, and documentation. These files are usually organized in a hierarchy. The top-level folder is called a content root. Modules normally have one content root. You can add more content roots.

How do I create a source folder in IntelliJ?

In the Project tool window ( Alt+1 ), right-click the node in which you want to create a new directory and select New | Directory. Alternatively, select the node, press Alt+Insert , and click Directory. Name the new directory and press Enter .

How do I search all folders in IntelliJ?

Use ⇧⇧ (macOS), or Shift+Shift (Windows/Linux), to bring up the Search Everywhere dialog. You can search across Classes, Files, Symbols and Actions. You can also use forward slash to filter the results to a specific area, such as /editor.


We have a FAQ article covering this question.

[The .idea] format is used by all the recent IDE versions by default. Here is what you need to share:

  • All the files under .idea directory in the project root except the workspace.xml and tasks.xml files which store user specific settings
  • All the .iml module files that can be located in different module directories (applies to IntelliJ IDEA)

Be careful about sharing the following:

  • Android artifacts that produce a signed build (will contain keystore passwords)
  • In IDEA 13 and earlier dataSources.ids, datasources.xml can contain database passwords. IDEA 14 solves this problem.

You may consider not to share the following:

  • .iml files for the Gradle or Maven based projects, since these files will be generated on import
  • gradle.xml file, see this discussion
  • user dictionaries folder (to avoid conflicts if other developer has the same name)
  • XML files under .idea/libraries in case they are generated from Gradle or Maven project

.idea directory is a replacement for the old .ipr (Idea Project) file and if you want to share the project between users, then you need to share .idea folder (with the exceptions mentioned in the FAQ) and all the .iml files.


Refer to GitHub's JetBrains.gitignore file to always have an updated listing of which files to ignore.


Not an exact answer to the question, but there are sample .gitignore files available here, including one for JetBrains which includes IntelliJ.


You might find this post interesting: Merges on IntelliJ IDEA .IPR and .IWS files

It seems to conclude that you should add all files except for: workspace.xml, dataSources.xml, sqlDataSources.xml and dynamic.xml. The answer there is focusing on having files that do not change simply from opening the editor or making ide specific changes.


I'm using PHPStorm.

Here is an example snippet for your .gitignore

# Ignore the following 2 PHPStorm files only workspace and tasks file
**/.idea/workspace.xml
**/.idea/tasks.xml

All other files in the .idea directory should be committed to your repository.

e.g: (commit everything else in the .idea directory)

new file:   .idea/.name
new file:   .idea/encodings.xml
new file:   .idea/framework.iml
...

Docs: How to manage projects under Version Control Systems

Here is what you need to share:

All the files under .idea directory in the project root except the workspace.xml and tasks.xml files which store user specific settings

All the .iml module files that can be located in different module directories (applies to IntelliJ IDEA)

So basically, commit everything except workspace.xml and tasks.xml.