IDE Files .gitignore for VS Code, IntelliJ, and Eclipse

Manage IDE configuration files in .gitignore for VS Code, IntelliJ IDEA, and Eclipse. Learn what to share with your team and what to keep personal.

IDE

Detailed Explanation

IDEs generate project configuration files that can cause merge conflicts and repository bloat. The challenge is that some files should be shared for team consistency while others are strictly personal. Here is a comprehensive guide for the three most popular IDEs.

VS Code (.vscode/ directory):

Use the wildcard-plus-negation pattern to selectively share settings:

.vscode/*
!.vscode/settings.json
!.vscode/extensions.json
!.vscode/launch.json
!.vscode/tasks.json

Commit settings.json (shared formatting rules), extensions.json (recommended extensions), launch.json (debug configurations), and tasks.json (build tasks). Ignore everything else: .vscode/history/, *.code-workspace, and IntelliSense caches like .browse.c_cpp.db*.

IntelliJ IDEA / JetBrains IDEs (.idea/ directory):

The simplest approach is to ignore everything:

.idea/
*.iml
*.iws

The .idea/workspace.xml file changes every session and is the biggest source of meaningless diffs. *.iml files contain absolute local paths to SDKs and JARs. If you want to share code style, use the selective approach: .idea/* then !.idea/codeStyles/ and !.idea/inspectionProfiles/. Many teams prefer sharing styles via .editorconfig instead, which is IDE-agnostic.

Eclipse (.project, .classpath, .settings/):

.project
.classpath
.settings/
bin/
.metadata/
*.launch

Eclipse scatters configuration across the project root. .classpath contains absolute JDK paths that differ between machines. .settings/ holds workspace preferences — some teams selectively commit .settings/org.eclipse.jdt.core.prefs for shared compiler settings using negation patterns.

The global gitignore approach:

Since IDE choice is personal, the cleanest solution is to put IDE patterns in each developer's global gitignore (git config --global core.excludesFile ~/.gitignore_global) rather than cluttering every project. This way, a Vim user is not forced to maintain IntelliJ patterns, and a VS Code user does not need Eclipse entries.

Removing already-committed IDE files: If .idea/ or .vscode/ was committed, git rm -r --cached .idea/ removes it from tracking without deleting local files. Warn the team first, as this resets everyone's IDE configuration on next pull.

Use Case

A cross-functional team using VS Code, IntelliJ, and Eclipse needs a unified .gitignore strategy that prevents IDE configuration conflicts while sharing useful debug and formatting settings.

Try It — .gitignore Generator

Open full tool