Git has its standard mechanisms for ignoring files, basically:
- Templates read from a .gitignore file in the same directory or in any parent directory.
- Templates are read from $ GIT_DIR / info / exclude.
- Templates read from the file specified in the configuration variable "Core.excludesFile".
IntelliJ, however, adds its own mechanism for ignoring files:
The Version Control window, the Local Changes tab, the Configure Ignored Files button (on the left). IntelliJ just never does a “git add” for files ignored in this way. Please note that this is NOT the same as git "gitignore". The effect inside IntelliJ is the same, but it is not very transparent what is happening - as mentioned in the IDEA issue in CrazyCoder's comment.
On the git command line, “git status” will display “IntelliJ-ignored files” as “Untracked files” (use “git add ...”). If they are directories, "git status" does not even mention the files contained in them, because the directory is already "unverified".
Correctly "Git -ignored" files do not display at all with "git status", that is, there is no suggestion to use "git add ...".
The best strategy is probably to never use the IntelliJ ignore mechanism and rely only on Git gitignore. For a Maven project in IntelliJ, I am currently using these lines in a private gitignore file that the Git configuration variable "core.excludesfile" points to:
/.idea/ target/
source share