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

前端 未结 18 1869
隐瞒了意图╮
隐瞒了意图╮ 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:12

    While it's not been too long that I made the switch to Rubymine, I found it challenging ignoring .idea files of Rubymine from been committed to git.

    Here's how I fixed it

    If you've not done any staging/commit at all, or you just spinned up a new project in Ruby mine, then simply do this

    Option 1

    Add the line below to the .gitignore file which is usually placed at the root of your repository.

    # Ignore .idea files
    .idea/
    

    This will ensure that all .idea files are ignored from been tracked by git, although they will still remain in your project folder locally.

    Option 2

    If you've however done some staging/commit, or you just opened up an existing project in Ruby mine, then simply do this

    Run the code in your terminal/command line

    git rm -r --cached .idea
    

    This deletes already tracked .idea files in git

    Next, include .idea/ to the .gitignore file which is usually placed at the root of your repository.

    # Ignore .idea files
    .idea/
    

    This will ensure that all .idea files are ignored from been tracked by git, although they will still remain in your project folder locally.

    Option 3

    If you've however done some staging/commit, or you just opened up an existing project in Ruby mine, and want to totally delete .idea files locally and in git, then simply do this

    Run the code in your terminal/command line

    git rm -r --cached .idea
    

    This deletes already tracked .idea files in git

    Run the code in your terminal/command line

    rm -r .idea
    

    This deletes all .idea files including the folder locally

    Next, include .idea/ to the .gitignore file which is usually placed at the root of your repository.

    # Ignore .idea files
    .idea/
    

    This will ensure that all .idea files are ignored from been tracked by git, and also deleted from your project folder locally.

    That's all

    I hope this helps

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

    I tried to added those files into my .gitignore and it was useless...

    Nevertheless, as Petr Syrov said, you can use git rm -r --cached .idea into your terminal and those files won't be a problem anymore!

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

    For me there was only one solution to remove .idea folder than commit file .gitignore with ".idea" and than use IDE again

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

    Add .idea/* to your exclusion list to prevent tracking of all .idea files, directories, and sub-resources.

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

    using git rm -r --cached .idea in your terminal worked great for me. It disables the change tracking and unset a number of files under the rubymine folder (idea/) that I could then add and commit to git, thus removing the comparison and allowing the gitignore setting of .idea/ to work.

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

    JetBrains has a .gitignore_global on GitHub.

    0 讨论(0)
提交回复
热议问题