Search code examples
gitmavenintellij-idea

IntelliJ IDEA 2019+ Git "Commit Directory" showing excluded maven target folders


I use a multi-module maven project. And for me it is a common practice to click with the right button of the mouse on root module and simply select Git -> Commit Directory... option.

In that scenario, I'm always seeing these target folders and I have to always uncheck them. Is there a configuration to hide these target folders when using commit command? I'm also using .gitignore but it doesn't seem to be working.

enter image description here

Thanks for any help!


Solution

  • To prevent files from committing, you should add them to .gitingore. Gitingore, however, affects only unversioned files.

    According to the screenshot, files from the target folders are already tracked by git, thus adding to .gitingore does not affect them. You need to stop tracking them in git first - this can be done with git rm --cached command.