139

Our team has just moved from Netbeans to IntelliJ 9 Ultimate and need to know what files/folders should typically be excluded from source control as they are not "workstation portable", i.e.: they reference paths that only exist on one user's computer.

As far as I can tell, IntelliJ wants to ignore most of the .idea project including

.idea/artifacts/*
.idea/inspectionProfiles/*
.idea/copyright/*
.idea/dataSources.ids
.idea/dataSources.xml
.idea/workspace.xml

However, it seems to want to check in the .iml files that exist in each module's root directory.

I originally checked in the entire .idea directory via the command line which is obviously not aware of what "should" be ignored by IDEA. Is the entire .idea directory typically ignored?

Pang
  • 9,564
  • 146
  • 81
  • 122
benstpierre
  • 32,833
  • 51
  • 177
  • 288

7 Answers7

115

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.

Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • 3
    Yes, it's up to date, there were no major changes in the project files. – CrazyCoder Sep 19 '12 at 15:40
  • 90
    @CrazyCoder (+1) It would make our lives easier if you guys would put the project-specific files and user-specific files in separate directories. – I. J. Kennedy Jan 15 '13 at 00:52
  • 3
    Commenting on an old-ish thread, but the FAQ's approach of sharing entire .idea folder (except workspace.xml and tasks.xml) is problematic because various files change between machines and between sessions. What really bugs me: Python /Library on Mac is on two different places on different Macs, so pycharm.xml abounces around. – Matthew Cornell Apr 10 '13 at 14:50
  • @MatthewCornell, this can be solved by renaming your Python Interpreter so that it has the same name on all the machines (instead of using the default name that is the full path to the binary). Updated document is also [available here](http://intellij-support.jetbrains.com/entries/23393067). – CrazyCoder Apr 10 '13 at 15:09
  • 32
    that's a pretty poor excuse for a FAQ. it's a big thread with people asking question. how about an example .gitignore for a project? – Jeffrey Blattman Jun 05 '13 at 21:24
  • 18
    it's unbelievable / impossible there would be "some yes, some no" within the same folder --- is this still the same insanity four years later? thanks – Fattie Jun 05 '14 at 10:44
  • 1
    If the Android project is managed using Gradle and the Android Studio version is 1.5.1 then the entire .idea directory does not need to be checked in. As an experiment I tried opening a previously created Android Project which did not had .idea directory and was able to successfully open and run the project in Android Studio. – Anuroop Feb 26 '16 at 12:20
50

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

Pang
  • 9,564
  • 146
  • 81
  • 122
whyceewhite
  • 6,317
  • 7
  • 43
  • 51
6

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

Pang
  • 9,564
  • 146
  • 81
  • 122
CodeClimber
  • 4,584
  • 8
  • 46
  • 55
5

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.

Community
  • 1
  • 1
Tommy Andersen
  • 7,165
  • 1
  • 31
  • 50
4

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.

Community
  • 1
  • 1
Anil
  • 21,730
  • 9
  • 73
  • 100
0

Yes, I believe so. You can check the SVN configuration to see what's ignored and add anything that you think should be ignored.

duffymo
  • 305,152
  • 44
  • 369
  • 561
0

IntelliJ now creates its own .gitignore file in the .idea folder so you can safely add it to repository.

Jonathan Allen
  • 68,373
  • 70
  • 259
  • 447