Tips and tricks
Yes – but only the shareable parts of .idea/ (the files that describe the project, run‑configs, code‑style, inspections, etc.).
Everything that is user‑specific or regenerated by IntelliJ (caches, workspace.xml, tasks.xml, usage.statistics.xml, plugin state, etc.) should stay out of Git.
Why the mixed advice exists
| Strategy | What you commit | Pros | Cons / Risks |
|---|---|---|---|
| A. Commit nothing “ echo .idea/ >> .gitignore” | Zero IDE metadata | • Works for any IDE & keeps repo tiny. • No merge noise. | • Every clone has to re‑import/redo run configurations, inspection profiles, code‑style, etc. • If the team uses IntelliJ features (shared scopes, inspections), they can’t be shared. |
| B. Commit the whole folder | All files under .idea/ | • Easiest—no ignore rules to maintain. • Everyone gets exactly the same setup. | • Workspace junk (window positions, local toolboxes, plugin caches) changes constantly → ugly diffs & merge conflicts. • Leaks personal paths and secrets (e.g. AWS credentials XML). |
| C. Recommended hybrid (what JetBrains calls directory‑based projects) | Project‑level files only:*.iml, misc.xml, encodings.xml, vcs.xml, runConfigurations/, inspectionProfiles/, etc. | • Instant, identical project import for every clone. • Keeps run configs, code‑style, inspections in version control (similar to VS Code’s .vscode/).• No user‑specific churn. | • Need a small .gitignore (or .idea/.gitignore) that blacklists the noisy bits. |
JetBrains’ own template (Global/JetBrains.gitignore) and their support article both recommend strategy C: keep .idea/ under VCS but ignore workspace.xml, shelf/, and other high‑churn files. GitHubIntelliJ Support
How your repository looks today
java-testing/.idea/is committed, but you already ship:
That’s almost exactly strategy C.
Two extras you might still want to ignore because they can be recreated and tend to change:
gitignoreCopyEdit# Put either here or in .idea/.gitignore
.idea/**/tasks.xml
.idea/**/aws.xml # if AWS Toolkit installed
.idea/**/contentModel.xml # generated
.idea/**/caches/ # 2024+ versions
Typical check‑list before committing .idea/
- Generate or update
.gitignore
Use https://gitignore.io/intellij or the JetBrains template above. - Delete local noise once
git rm -r --cached .idea→ commit → re‑add only the wanted files. - Run
git statusafter every IntelliJ upgrade
New IDE versions sometimes create new cache files—add extra ignore rules as they appear. - For multi‑module Maven/Gradle projects
Commit*.imlunless you rely on auto‑import; in that case the IDE regenerates them, so ignore them (the template has these lines commented out with an explanation).
Alternatives & extra tooling
- IDE Settings Repository / IDESync – keeps personal settings in JetBrains Cloud, so you can ignore even more files.
- Gradle® & Maven® Tooling – when the build tool fully describes the project, you can often ignore
.imlandmodules.xmlsafely. - Workspace‑specific ignore – if one teammate prefers a totally clean repo, they can put
.idea/in their personal~/.config/git/ignorewithout affecting the team.
TL;DR for your repo
Your current setup (commit .idea but ignore workspace & caches) follows JetBrains’ own guidance and is perfectly fine.
Add tasks.xml (and any cache files that pop up) to the ignore list and you’re good to go.
Recent Comments
- admin on Vimeo Thumbnail Generator
- Robert Moeck on Vimeo Thumbnail Generator
- Rainer on Vimeo Thumbnail Generator
- Video Gallery WordPress Plugin /w YouTube, Vimeo, Facebook pages | Berita Online on Vimeo Thumbnail Generator
- Use Browserify Globally as Watcher in PhpStorm [ add Babelify ] – Digital Zoom Studio on Setup a .babelrc in your user directory