I have .idea in gitignore, but it is still in local changes

How can I fully gitignore the .idea folder?

I have .idea in gitignore, but it is still in local changes.

Here is my .gitignore file:


# Created by https://www.gitignore.io/api/webstorm,meteorjs,node

### WebStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml

# Sensitive or high-churn files:
.idea/dataSources/
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.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:
*.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
fabric.properties

### WebStorm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr


### MeteorJS ###
# default meteor build and local packages
.meteor/local

# meteor settings file
settings.json

# meteor build output files
*.tar.gz

# general swp files from vim
*.swp


### Node ###
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

27 comments
Comment actions Permalink

You must have added these files to the repository already... .gitignore is not used when selecting files to commit, it's used for adding only: files listed there are not suggested to be added. But, once they are added, they appear in Local Changes

1
Comment actions Permalink

Yes, I did.

How can I remove them from the repository or fix this issue in some other way?

0
Comment actions Permalink

You can use "git rm –cached <file>" to remove file from the repository, preserving its local version. Unfortunately there is no way to perform this action in UI

0
Comment actions Permalink

I ran `git rm ~/devel/flt/.idea/workspace.xml` and `git rm ~/devel/flt/.idea/workspace.xml --cached` and then commit and push. It is still showing in local changes.

0
Comment actions Permalink

hmm... and what does `git status` show?

0
Comment actions Permalink

I can confirm this.  PyCharm 2017.3.3 honors the .gitignore file for any other type of file except those in .idea.  I have to uncheck the files in that directory every time I do an add/commit.  I need to ignore these files because I have a repo I share with multiple sites that need to have different local IDE configurations.  Would be nice if it would also honor .gitignore for .idea/ if it is specified.  git add * does not have this issue from the command line.

1
Comment actions Permalink

.gitignore is respected - files listed there are not auto-added to Git. But, once you add them, they do appear in Local Changes

0
Comment actions Permalink

I ran into this problem today and found this thread, which doesn't seem to have a clear answer.  I had the preexisting files in my repo and needed to remove them, but the IDE kept showing my .idea/ files as changed in the Local Changes.  I was able to fix this by closing all instances of the IDE, then running `git rm --cached -r .idea`. I did this on each branch that I was working on and pushed those changes up to my repo.  Then I reopened the IDE and the issue was gone.  Hope this helps.

5
Comment actions Permalink

Yes, this is happening to me Git VCS totally sucks in PHPStorm. hehe. This issue is a true deal breaker. 

0
Comment actions Permalink

As it's written above, .gitignore is not used when selecting files to commit, it's used for adding only: files listed there are not suggested to be added. But, once they are added, they appear in Local Changes. This is expected behavior, not specific to PhpStorm.

-1
Comment actions Permalink

EVERY other Git gui does not do this, sorry. It's an undesired behavior by PHPStorm. You won't find this behavior on SourceTree for instance. 

1
Comment actions Permalink

In Git, it is only possible to ignore unversioned files. If a file is already tracked in git, it is not possible to ignore it. You need to stop tracking it in git, which can be done using git rm --cached command. After committing this change, files should go ignored, since there is a rule to ignore them already. See https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore, for example

And no, it's not a problem with PhpStorm, it's git own behavior

2
Comment actions Permalink

Yea, I don't think we are speaking the same language. EVERY other Git GUI I have used - SourceTree, Tower, GitKraken ignores files in .gitignore - as they should. It is only in PHPStorms VCS that I see these ignored files. It's a downside of using PHPStorm and something that is just inevitable. Until PHPStorm better immolates better Git management tools, it will just be janky.  

1
Comment actions Permalink

But I do think you have made very clear why this issue persists and why VCS is just bad in PHPStorm. So thank you for that at least. 

0
Comment actions Permalink
git status -s -uno | wc -l

31

PhpStorm Local Changes 58 files

Ok JetBrains - you do you. 

1
Comment actions Permalink

this is unacceptable and is causing us a lot of problems.

 this file cannot be ignored or removed and because of PhpStorm's bad code i can't work from home

.idea/dataSources/d18276ad-ff80-4a76-a574-0a67
1bd28583.xml 

since you refuse to fix it, i will have to vote with my wallet and find another IDE
0
Comment actions Permalink

I also had said problem. I had a project freshly ported over from eclipse and added the .idea folder to the .gitignore. To my disbelieve all files were already added to git as either new, or modified. When I removed them with git rm -r .idea -f, the project view crashed. After restarting IntelliJ, I was prompted to add the project as a Maven project. Thereafter, no files from the .idea folder were listed in git status.

0
Comment actions Permalink

There appears to be some effort to work on this now - someone _might_ be listening! But on the whole PHPStorm .gitignore functionality still sucks so bad compared to any commonly used git GUI. See this comment (They admit to a 'bug'! #winning) https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000276420/comments/360000418180

1
Comment actions Permalink

If someone still has the same issue, then it is worth checking the .idea/workspace.xml file.
They might be in project > component "ChangeListManager" > list name="Default Changelist"
For me deleting the rows reflecting those files was enough to clear it up. 

1
Comment actions Permalink

Looks like as of 2019.2.4, there is now a .idea/.gitignore:

# Default ignored files
/workspace.xml

It must have generated this from when I first created the .gitignore, but ignores future .gitignore additions to ./idea after the first time reading .gitignore.  I wanted to add /webServers.xml to this file to stop it from suggesting to add it at each commit but it had no effect.  I also tried to use File -> Invalidate Caches / Restart but it also had no effect.

JetBrains, please either make sure that any changes to <project_root>/.gitignore will either invalidate this, or stop creating a cache altogether for this which seems more problematic than it's worth.  It's a *GIT* management interface.  There should be no other authority other than .gitignore to look for which files to suggest for a commit.  Any more being "smart" about this just adds negative value to an otherwise excellent interface.

I also see the bug https://youtrack.jetbrains.com/issue/IDEA-148109 returns a 404 now.  I'll be filing a new bug if I can't find any other reference to this issue in the bug tracker.

0
Comment actions Permalink

@Craigmjackson

>I also see the bug https://youtrack.jetbrains.com/issue/IDEA-148109 returns a 404 now.

Just fix the URL and remove rubbish symbols at the end (as simple as that): https://youtrack.jetbrains.com/issue/IDEA-148109

0
Comment actions Permalink

I can't prove it but I believe this is happening from clicking "always add external changes" when asked.

0
Comment actions Permalink

This solved the issue for me -- I ran the command line `git rm --cached -r .idea` from the terminal. Then commit. I could delete the `.idea` folder. I already had .`idea/` in the .gitignore file. I could not find a way to do the whole process using UI though.

0
Comment actions Permalink

Same issue here.... Files were all new and .gitignore was ignored. I had to manually go delete the files from .idea/workspace.xml file to solve the issue. This is definitely a BUG that should get fixed!

1
Comment actions Permalink

Yes, same here. Files added to .gitIgnore should be removed from changelist (and from repository).

0
Comment actions Permalink

I have a directory of almost 20k auto-generated files that ARE in .gitignore and are NOT tracked by git (git status doesn't show them), but they appear in the changelist in GoLand and I have no way to remove them in the UI, unless I use "revert", but then it reverts the auto generated local files, from what I can tell. 

Very strange.

0
Comment actions Permalink

I had this problem, the solution for me was to :

Open Settings - Go to Version Control, remove all the directories except mine.

There was some vendor directories listed after a composer update, even if my vendor is listed in .gitignore

0

Please sign in to leave a comment.