Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to gitignore from the .idea folder?

Possible Duplicate:
Intellij Idea 9/10, what folders to check into (or not check into) source control?

I started using WebStorm for web development and am not sure what to add and what to exclude from our Git repository. Clearly some files inside the .idea folder are meant to be version controlled like the external library settings (jsLibraryMappings.xml) but others will probably change very often and are developer-specific (e.g., workspace.xml).

What is the recommended .gitignore pattern for WebStorm / IntelliJ IDEA?

P.S. There are already questions about this but usually focus only on whether to include the whole .idea folder or whether to fully exclude it. I think some of the files inside the .idea folder should be version controlled while others shouldn't and I'm trying to find out which ones.

like image 829
Borek Bernard Avatar asked Aug 15 '12 11:08

Borek Bernard


People also ask

Should you ignore .idea folder?

ignoring the idea folder is fine as not everyone uses them, and they are not part of your code - you (hopefully) don't need them on production, for instance. ignoring is fine, but removing is less of a good idea. It contains information for your local workspace.

What is stored in .idea folder?

The . idea folder (hidden on OS X) in the solution root contains IntelliJ's project specific settings files. These include per-project details such as VCS mapping and run and debug configurations, as well as per-user details, such as currently open files, navigation history and currently selected configuration.

Should I commit .idea folder?

You shouldn't ignore the idea folder. you're supposed to commit almost all of it to the repo. Adrian B.G.


3 Answers

The official support page should answer your question.

So in your .gitignore you might ignore the files ending with .iws, and the workspace.xml and tasks.xml files.

like image 185
hifkanotiks Avatar answered Oct 09 '22 19:10

hifkanotiks


For a couple of years I was a supporter of using a specific .gitignore for IntelliJ with this suggested configuration.

Not anymore.

IntelliJ is updated quite frequently, internal config file specs change more often than I would like and JetBrains flagship excels at auto-configuring itself based on maven/gradle/etc build files.

So my suggestion would be to leave all editor config files out of project and have users configure editor to their liking. Things like code styling can and should be configured at build level; say using Google Code Style or CheckStyle directly on Maven/Gradle/sbt/etc.

This ensures consistency and leaves editor files out of source code that, in my personal opinion, is where they should be.

like image 43
Frankie Avatar answered Oct 09 '22 17:10

Frankie


I just want to present a more recent alternative. There is an online tool that generates .gitignore files based on operating systems, IDEs and programming languages that you might be using.

gitignore.io


EDIT Disclaimer: Do not copy this file, copy the file generated by the website instead, they do a good job on keeping it updated. This is just an example.

The file generated for IntelliJ contains the following

# Created by https://www.gitignore.io/api/intellij

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
like image 306
GabrielOshiro Avatar answered Oct 09 '22 17:10

GabrielOshiro