Tips and tricks

Should we commit .idea folder

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

StrategyWhat you commitProsCons / 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 folderAll 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:
    • .idea/.gitignore that ignores workspace.xml & shelf/
    • Root .gitignore that excludes modules.xml, jarRepositories.xml, libraries/, *.imlGitHubGitHub

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/

  1. Generate or update .gitignore
    Use https://gitignore.io/intellij or the JetBrains template above.
  2. Delete local noise once
    git rm -r --cached .idea → commit → re‑add only the wanted files.
  3. Run git status after every IntelliJ upgrade
    New IDE versions sometimes create new cache files—add extra ignore rules as they appear.
  4. For multi‑module Maven/Gradle projects
    Commit *.iml unless 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 .iml and modules.xml safely.
  • Workspace‑specific ignore – if one teammate prefers a totally clean repo, they can put .idea/ in their personal ~/.config/git/ignore without 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.

{"type":"main_options","images_arr":"'#ffffff'","enable_ajax":"off","soundcloud_apikey":"","bg_isparallax":"off","bg_slideshow_time":"0","bg_transition":"slidedown","site_url":"https:\/\/digitalzoomstudio.net","theme_url":"https:\/\/digitalzoomstudio.net\/wp-content\/themes\/qucreative\/","blur_ammount":"26","width_column":"50","width_section_bg":"","width_gap":"30","border_width":"0","border_color":"#ffffff","translate_cancel_comment":"Cancel reply","translate_leave_a_comment":"Leave a comment","translate_leave_a_comment_to":"Leave a comment to","is_customize_preview":"off","width_blur_margin":"30","gallery_w_thumbs_autoplay_videos":"off","content_enviroment_opacity":"30","menu_enviroment_opacity":"70","base_url":"https:\/\/digitalzoomstudio.net"}
{"type":"darkfull"}