How to gitignore .idea files

Answered

The links in the old posts explaining this are obsolete. 

How do I ignore the .idea files?

Step by step please.. 

Simply telling me to add them to gitignore is not going to help me. Where is gitignore? Do I have to create a gitignore 'file'? Where do I create it? Do I have to create it in every repo I use with rubymine?

1
15 comments

Hello,

.gitignore file is usually placed at the root of your repository. The general documentation you can find here:

https://help.github.com/articles/ignoring-files/

https://git-scm.com/docs/gitignore

1

Your personal dev tools-related git exclusions (related to YOUR O.S., YOUR editor/IDE, YOUR <whatever>) shouldn't pollute the shared `.gitignore`.

I store mine is `~/.gitignore_global`

Example:

# file: ~/.gitignore_global
.DS_Store
.idea

9

Go to File > Settings > Version Control > Ignored Files 


then add your folder or file to git ignore.

hope it helps.

5

See this link for suggested contents of a global JetBrains .gitignore file, which you could prune to work for your own case.

https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore

If unfamiliar with github, you'll need to click the `raw` button above the file if you want it in an easy to copy-paste format without the line numbers and frame.

5

|   Go to File > Settings > Version Control > Ignored Files 
|   then add your folder or file to git ignore.

To be clear, these are two separate steps.  The "Ignored Files" in the first step is an internal ignore list maintained by PHPStorm, separate from GIT.  If you use this function, it WILL lead to errors if you use any other kind of git client on your machine.  JetBrains really needs to change the name of this menu item/function to reflect that it has nothing to do with ignoring the file at the version control level. It ONLY controls whether PHPSTorm will recognize it.  It will still remain in your GIT repo, but simply not display in the PHPStorm interface.  Very confusing.

So when this person says "then add your folder or file to git ignore" he's basically saying, no there's no way for PHPSTorm to handle this for you. You have to do it manually.

7

Does not work anymore

1

It did work, just the UI seems misleading.  Actually , it is not misleading , it is just super slow and takes forever to update the UI. Bad user experience

1

@Yingdi1111, could you please specify your IDE version? Which delay was there in the UI refresh?

0

Where do I put the global .gitignore in Windows? %USERPROFILE%\.gitignore didn't do the trick.

0

Andreas Dau, have you configured it via

git config --global core.excludesFile

command? Could you please specify what exactly doesn't work and which output you get for

git config --global core.excludesFile
1

There is no Ignored Files under Version Control in IntelliJ IDEA.

0

This should be able to be accomplished by right clicking the file and choosing the correct item. What a GUI failure!

0

Afargnoli
Builtin VCS Ignored FIles list has been deprecated in 2019.2 in favor of native ignores. Now the files should be ignored in a way provided by the VCS in use (e.g. .gitignore in git, svn:ignore properties, etc).
If a file hasn't been added to git then you can add file to gitignore by right-click on a file | Git | Add to .gitignore

1

Olga Kuvardina hints at it above, but the best explanation I found to set up a global ignore file is this github link 

0

The first thing I had to do is make sure the files I am adding to .gitignore are not tracked by git in first place.

git rm <file> --cached

Then intellij can work as expected.

1

Please sign in to leave a comment.