Support for VCS Ignores in IntelliJ IDEA and IntelliJ-based IDEs

IntelliJ IDEA 2019.2 will add native support for Git ignore to the platform, which means that the upcoming IntelliJ IDEA 2019.2 and all v2019.2 IntelliJ-based IDEs will have Git, Mercurial, Subversion, and Perforce native ignore file handling out of the box.
With this post, we will summarize all the features that IntelliJ IDEA and IntelliJ-based IDEs will have to offer, and hopefully answer any questions you may have.
Support for VCS ignores in IntelliJ-based IDEs
With v2019.2, we have switched entirely to native handling of ignored files and removed the built-in mechanism in the IntelliJ Platform for ignoring files. So, there is no more fiddling around with the Ignored Files table in the Preferences/Settings | Appearance & Behavior | Version Control.
Now the process of handling the VCS (Git, Mercurial, Subversion) ignored files is straightforward – simply add a file to the ignored file from either the Project Tree or the local changes tab of the VCS tool window.
Just a quick heads up… The list of Ignored Files that have been added via IntelliJ’s obsolete mechanism will not be automatically migrated to the .gitignore file, you’ll need to add the necessary files manually.
IntelliJ IDEA 2019.2 and the IntelliJ-based IDEs correctly show the file status by highlighting the ignored files in the project tree; such files are marked with an olive color. Code completion also now works in .gitignore files.
When you create a new project in IntelliJ IDEA or any other IntelliJ-based IDEs now, the IDE creates a .gitignore file in the .idea directory which lists all the files that are not intended for sharing.
.ignore plugin
For many years, the .ignore plugin provided the Git ignore and HG ignore support for IntelliJ-based IDEs. So when we decided to implement this functionality as a part of the IntelliJ Platform, we began working closely with Jakub Chrzanowski, the author of the .ignore plugin.
We very much appreciate the work that Jakub Chrzanowski has been doing for so many years, and we want to say a big thank you to him!
We have agreed with Jakub that from now on, the .ignore plugin will be maintained by JetBrains. To learn more about our collaboration, please read the interview with Jakub.
What does this mean for you? For sure, the .ignore plugin will still be available from our repository, but depending on the version that you use, this plugin will provide different functionality. For IntelliJ-based IDEs v2019.1 or lower, it will provide full support for VCS ignores. For the upcoming v2019.2 and all subsequent versions, it will provide only advanced functionality of VCS ignores, such as .dockerignore, .npmignore, .prettierignore, etc, as the main functionality will be part of the platform itself.
Download and try out the upcoming IntelliJ IDEA 2019.2!
Let us know us what you think – here in the comments, in our issue tracker, or on Twitter.
Happy Developing!
LeiChang Yan says:
July 25, 2019The support for svn is not friendly, and the previous File ignore Support does not seem intuitive. Passing `svn:ignore` will generate a lot of configuration and will be submitted to the repository。
Dmitriy Smirnov says:
July 25, 2019It is possible to provide “global” patterns that do not require committing svn:ignore property – see http://svnbook.red-bean.com/en/1.8/svn.advanced.props.special.ignore.html
Thibaut says:
July 25, 2019I will miss the previous feature of integrated ignore files/folders. I had use case of ignoring files that did not belong into the .gitignore file.
Example: I have a project A under git that depend on an other project B under git too. Both are in the same windows pycharm.
I’m working on project A but I can’t edit project B, and so I don’t edit the .gitignore file of project B.
But I have .idea of project B showing in version control.
Dmitriy Smirnov says:
July 25, 2019Git provides 3 ignore files, the global, project-level, and local. Only project-level gitignore is committed to the repo. Other two are local, and can include any ignores patterns you need.
See https://git-scm.com/docs/gitignore#_description
Thibaut says:
July 29, 2019Ohhh, I didn’t knew that. Thanks.
Thibaut says:
July 29, 2019So, I did manage to create a global gitignore file.
Still a way to handle it directly from jetbrains IDE would be nice (the old option could just edit the $GIT_DIR/info/exclude for us).
It’s kinda annoying to lose time editing config files when there was an option out of the box before.
Dmitriy Smirnov says:
August 12, 2019We are planning to add the action – https://youtrack.jetbrains.com/issue/IDEA-219087
Scott MacDonald says:
July 25, 2019I find the opposite is true from what this post claims. I used to be able to add things to .gitignore via the context menu (I guess I had the .ignore plugin? Hard to say–I don’t have it now and it doesn’t come up when I search for it in the marketplace), but now upon upgrading to 2019.2 that option is simply GONE.
Scott MacDonald says:
July 25, 2019Following up on my own comment, I was mistaken–apparently I wasn’t using .gitignore before after all, as none of my projects appear to have .gitignore files in them after all. When I add a .gitignore file then the option does appear in the context menu as advertised.
Dmitriy Smirnov says:
July 25, 2019Yes, the option to add to ignore does not appear until .gitinogre is present. We plan to fix it – please follow https://youtrack.jetbrains.com/issue/IDEA-217486
Tal says:
July 29, 2019Hi,
I am using 2019.2.
On my “Default Changelist” I have about 80 files, most of them should be ignored.
I rClick each one of them and I don’t find the “add to .gitignore” menu item!
Also, I cannot drag them over to the “unversioned Files: change list.
Please advise.
Thanks
Dmitriy Smirnov says:
August 12, 2019It is only possible to ignore files that are in the Unversioned state. Rollback the Added files so the become unversioned, and then ignore.
Rodrigo Nascimento says:
July 29, 2019I’m missing the templates. It was easier to create the .gitignore in advance based on my project context (e.g. I usually do a lot of Terraform coding, and the .ignore plugin used to come with the usual ignores for this case). Also, it used to suggest files that are not shown in the Project Tree (i.e. OS files like MacOS .DS_Store).
Dmitriy Smirnov says:
August 12, 2019Templates are still provided by the .ignore plugin that is available in the Marketplace.
Yogi says:
July 30, 2019I prefer the previous feature, I don’t want to commit .gitignore to the repo. But editing config file is losing much more time. It’s not convenient to use.
Dmitriy Smirnov says:
August 12, 2019We are going to add an option to edit local ignore file – see https://youtrack.jetbrains.com/issue/IDEA-219087
Reto says:
July 30, 2019I also think that it is a step backwards. It should be possible to ignore files/directories in a specific project without change the VCS file (like .gitignore) or global VCS options.
The fact that the ignore action is gone in VCS toolwindow (at least in case of SVN, see IDEA-219245) also just demonstrate that the changes are not well studied and tested in a wider user and use-case range.
I hope the old ignore logic (handled by IDEA without VCS logic) will come back in the future.
Dmitriy Smirnov says:
August 12, 2019There are no plans to return the old logic. It duplicates functionality of native ignore and is confusing for a lot of users.
We will improve the native ignores support to allow ignoring files locally, though. E.g. https://youtrack.jetbrains.com/issue/IDEA-219087
Alexander Kirsch says:
July 30, 2019If you remove the VCS ignore functionality, it would be nice if Idea would respect at least the global-ignores from the local subversion configuration. These are the global ignores that are used in the subversion command-line tools. Thank you!
Dmitriy Smirnov says:
August 12, 2019IDEA does respect SVN global ignores, as the file statsu is queried via svn command-line client.
Yogi says:
July 31, 2019I prefer the previous ignore logic too!!
Simone says:
July 31, 2019I agree with Retro
wang says:
July 31, 2019I also think that it is a big step backwards
wang says:
July 31, 2019Please bring back the plugin .ignore!!!
Dmitriy Smirnov says:
August 12, 2019The plugin is available in the marketplace
Damian Munguia says:
July 31, 2019I’m not getting that option, I’m I missing something already at 2019.2
Kevin S says:
August 1, 2019This is definitely a step backwards. I had templates with everything I could possibly need for my team. Now I have to go through one by one and add it, or keep a .ignore file and copy paste. If I can do that without a plugin what is the point of having it built in?
Dmitriy Smirnov says:
August 12, 2019.ignore plugin is still available in the Marketplace
Grant Humphries says:
August 1, 2019Is the functionality that grays out ignored folders the project pane gone? That was one of my favorite things about the plugin. Also like the feature that showed which entries where actively ignoring files when viewing the .gitignore which also doesn’t seem to have been ported into the core.
Dmitriy Smirnov says:
August 12, 2019IntelliJ highlights ignored files out of the box. It uses a different color by default, but you can configure colors in Settings | Version Control | FIle Status Colors
.ignore plugin is still available in the marketplace
Matthias Harmuth says:
August 30, 2019But it doesn’t gray out ignored folders which was done by the .ignore plugin. Hope that gets implemented soon
Grant says:
September 2, 2019I think the issue is that folders that are ignored and empty are not grayed out now, but were with the old plugin. I can understand the new functionality is implemented this way given how git works, but I liked the empty, ignored folders being marked as ignored
Alan Tang says:
August 2, 2019Is it possible to have option turn off this build-in function. To let me re-enable “.ignore” plugin? That plugin is much more better the the build-in function.
Dmitriy Smirnov says:
August 12, 2019.ignore plugin is available in the Marketplace as it used to be. Make sure to update it to the latest version to use with 2019.2
Melvin A says:
August 6, 2019It is very annoying to commit the files in .gitignore. I updated the IDE and all the Intellij config files were added to the changelist. Without noticing that I stashed the changes. All the version control configurations are gone. I have to then manually use git command to unstash them. That feature was cool. I don’t think removing it is a good idea.
Dmitriy Smirnov says:
August 12, 2019> It is very annoying to commit the files in .gitignore
If you don’t want to commit to the project-level .gitignore, there are other options.
Git provides 3 ignore files, the global, project-level, and local. Only project-level gitignore is committed to the repo. Other two are local, and can include any ignores patterns you need.
See https://git-scm.com/docs/gitignore#_description
Kakus says:
August 9, 2019It feels so bad to see thousands of build files shown in the unversioned files list and I just can’t ignore them.
BTW, I am using SVN for version control.
Dmitriy Smirnov says:
August 12, 2019You can, using svn:ignore property and svn global-ignores setting.
See http://svnbook.red-bean.com/en/1.8/svn.advanced.props.special.ignore.html
IntelliJ provides an action to add files/patterns to the svn:ignore of the parent folder.
Doug Toland says:
June 8, 2020Unfortunately, intellij ignores global svn ignores
Ewa says:
August 12, 2019Note that by default .gitignore file is created in .idea directory, so if you want to ignore file from outside, the option will simply not be at the context menu.
It’s really unintuitive. If it must be like that, you could point it out in article… But personally I don’t see a reason to create it on this level, not on main.
Dmitriy Smirnov says:
August 13, 2019.gitingore inside .idea folder is created ONLY when there is no one in the root that already ignores required files. A lot of users do not like IDE silently creating/editing .gitignore in the root.
> so if you want to ignore file from outside, the option will simply not be at the context menu.
That’s will be fixed – https://youtrack.jetbrains.com/issue/IDEA-217486
Ruslan says:
August 16, 2019There is still a problem with ignoring *.iml files for Maven projects. On one hand it is recommended to be ignored here https://intellij-support.jetbrains.com/hc/en-us/articles/206544839?page=3#comments
{quote}
You may consider not to share the following:
.iml files and .idea/modules.xml file for the Gradle or Maven based projects, since these files will be generated on import
{quote}
but on the other hand .iml files contain many other useful stuff that is not generated by Maven, for example, the facet configuration. So how can I share the facet configuration and still ignore the library entries (e.g. <orderEntry type="library" name="Maven…) that are updated by Maven?
I assume it is an oversight of the format and the library entries should be extracted to separate configuration files that can be ignored separately?
Thanks,
Ruslan
btw, I have already asked it here https://intellij-support.jetbrains.com/hc/en-us/articles/206544839?page=3#comments
just hoping to get an answer here
Dmitriy Smirnov says:
August 19, 2019This is, in fact, a question about the project settings storage, rather than ignore support. IDE could store all shareable settings in one folder, and all non-sharable in another. There is a request for that – see https://youtrack.jetbrains.com/issue/IDEA-90785
Currently, you can only track the entire IML file. It is not a big deal to have it tracked even when the project is imported from maven. The inconvenience is that the iml file will be, or at least might be, modified by every maven project reimport.
Fabio says:
August 27, 2019Since native ignore was implemented I find the project view pretty useless.
In all my Maven projects I usually have a .gitignore file where I include “target/” to make sure no build output is committed.
Before IntelliJ 2019.2 I used to be able to browser the target folder in the “Project” view.
Now it the “target” folder is visible, even with the option “Show Excluded Files” activated.
When I switch to the “Projct Files” view, it shows at least the whole folder structure, but still no files. I don’t get the point of this. Am I missing something?
Now I always have to open file browser just to look at a Maven generated HTML report.
Shannon says:
September 19, 2019The previous ignored files implementation was much better for subversion. The subversion global-ignores config feature is inconvenient and does not work well for ignoring specific sub folders in large project with many modules without specifically ignoring them with svn:ignore properties in the repository.
JT says:
September 25, 2019What do you suggest for users of non-Git/Mercurical/Subversion VCS applications, such as TFS in my case?