Rubymine: How to make Git ignore .idea files created by Rubymine

前端 未结 18 1870
隐瞒了意图╮
隐瞒了意图╮ 2020-12-07 08:35

I use Rubymine for Rails projects. Very often, Rubymine makes changes in .idea/* files that I don\'t care about. But it keeps preventing me from checking out ne

相关标签:
18条回答
  • 2020-12-07 09:26

    Use .ignore plugin: https://plugins.jetbrains.com/plugin/7495--ignore

    It manages a lot of paths/patterns for you automatically and also has many useful extra features. It's compatible with:

    • IntelliJ IDEA
    • PhpStorm
    • WebStorm
    • PyCharm
    • RubyMine
    • AppCode
    • CLion
    • GoLand
    • DataGrip
    • Rider
    • MPS
    • Android Studio
    0 讨论(0)
  • 2020-12-07 09:30

    just .idea/ works fine for me

    0 讨论(0)
  • 2020-12-07 09:35

    What about .idea/* ? Didn't test, but it should do it

    0 讨论(0)
  • 2020-12-07 09:38

    You may use gitignore for advanced gitignore file generation. It's fast, easy and cutting edge tags are automatically generated for you.

    Use this link for most of jetbrains softwares (intelij, phpstorm...) jetbrains .gitignore file

    [edit]

    Below is the generated gitignore file for Jetbrains Softwares, this will prevent you from sharing sensitive informations (passwords, keystores, db passwords...) used by any of Jetbrains software to manage projects.

    # Created by https://www.gitignore.io
    
    ### Intellij ###
    # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
    
    *.iml
    
    ## Directory-based project format:
    .idea/
    # if you remove the above rule, at least ignore the following:
    
    # User-specific stuff:
    # .idea/workspace.xml
    # .idea/tasks.xml
    # .idea/dictionaries
    
    # Sensitive or high-churn files:
    # .idea/dataSources.ids
    # .idea/dataSources.xml
    # .idea/sqlDataSources.xml
    # .idea/dynamic.xml
    # .idea/uiDesigner.xml
    
    # Gradle:
    # .idea/gradle.xml
    # .idea/libraries
    
    # Mongo Explorer plugin:
    # .idea/mongoSettings.xml
    
    ## File-based project format:
    *.ipr
    *.iws
    
    ## Plugin-specific files:
    
    # IntelliJ
    /out/
    
    # mpeltonen/sbt-idea plugin
    .idea_modules/
    
    # JIRA plugin
    atlassian-ide-plugin.xml
    
    # Crashlytics plugin (for Android Studio and IntelliJ)
    com_crashlytics_export_strings.xml
    crashlytics.properties
    crashlytics-build.properties
    

    Generated code is also well commented. hope it helps :)

    0 讨论(0)
  • 2020-12-07 09:38

    If you've already made an initial commit and you have .idea files showing up as new files in git, you will need to remove the files first and then commit them. The following steps will do the trick

     1. git rm --cached -r .idea/
     2. Add .idea/ to **.git/info/exclude** or **.gitignore**
     3. git commit -m 'ignore .idea/ files'
    

    It's explained in detail in this link here: https://devconnected.com/how-to-clear-git-cache/

    0 讨论(0)
  • 2020-12-07 09:39

    I suggest reading the git man page to fully understand how ignore work, and in the future you'll thank me ;)

    Relevant to your problem:

    Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning:
    
    A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same     as pattern "foo". "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo".
    
    A trailing "/**" matches everything inside. For example, "abc/**" matches all files inside directory "abc", relative to the location of the .    gitignore file, with infinite depth.
    
    A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b",     "a/x/y/b" and so on.
    
    Other consecutive asterisks are considered invalid.
    
    0 讨论(0)
提交回复
热议问题