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.

image1

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!

About Zlata Kalyuzhnaya

IntelliJ IDEA Marketing Manager at JetBrains. twitter: @ZlataKalyuzhnay ‏
This entry was posted in New Features. Bookmark the permalink.

45 Responses to Support for VCS Ignores in IntelliJ IDEA and IntelliJ-based IDEs

  1. LeiChang Yan says:

    The 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。

  2. Thibaut says:

    I 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.

  3. Scott MacDonald says:

    I 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:

      Following 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.

  4. Tal says:

    Hi,
    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:

      It is only possible to ignore files that are in the Unversioned state. Rollback the Added files so the become unversioned, and then ignore.

  5. Rodrigo Nascimento says:

    I’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).

  6. Yogi says:

    I 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.

  7. Reto says:

    I 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.

  8. Alexander Kirsch says:

    If 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!

  9. Yogi says:

    I prefer the previous ignore logic too!!

  10. Simone says:

    I agree with Retro

  11. wang says:

    I also think that it is a big step backwards

  12. wang says:

    Please bring back the plugin .ignore!!!

  13. Damian Munguia says:

    I’m not getting that option, I’m I missing something already at 2019.2

  14. Kevin S says:

    This 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?

  15. Grant Humphries says:

    Is 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:

      IntelliJ 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:

        But it doesn’t gray out ignored folders which was done by the .ignore plugin. Hope that gets implemented soon

        • Grant says:

          I 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

  16. Alan Tang says:

    Is 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:

      .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

  17. Melvin A says:

    It 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:

      > 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

  18. Kakus says:

    It 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.

  19. Ewa says:

    Note 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:

      .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

  20. Ruslan says:

    There 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:

      This 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.

  21. Fabio says:

    Since 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.

  22. Shannon says:

    The 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.

  23. JT says:

    What do you suggest for users of non-Git/Mercurical/Subversion VCS applications, such as TFS in my case?

Leave a Reply

Your email address will not be published. Required fields are marked *