Ignore .idea folder from git in PHPStorm
By default (?) PHPStorm will create a hidden folder named .idea directly within your project, containing user-specific stuff like chosen PHP version, syntax highlighting settings etc. This can be quite annoying as these files mess up your git repo and create conflicts when being committed into the repo (as other team members also have their own setting). And beside that, this simply doesn’t belong in there.
Make PHPStorm ignore .idea folder
1.) First, make git ignore the .idea folder via Settings (CTRL+ALT+S): In the Project Settings > Version Control > Ignored Files dialog there’s a green “plus” sign on the right, click this and simply add the .idea folder. This screenshot says it all:
2.) Open the “local” terminal in PHPStorm (which is open by default, look at the left bottom of the screen for TERMINAL), make sure you are in your project’s folder and do:
git rm --cached .idea/*
This will remove all files in the .idea folder from Git. Note: From Git ! Not from the system. Don’t confuse rm (which will delete things in linux) with git rm (which will remove files from git’s commit list) ! The result should look like:
BY THE WAY: Does anyone know how to open the terminal with a shortcut ? Please comment if you like.
3.) Now try to commit: PHPStorm should not have the entire .idea folder in its commit list.
Note: By step 2 I had to add “-r”: `git rm –cached .idea/* -r`
try this instead : git rm -r –cached .idea/*
great tip, thanks
I got an error with that git command and had to add -r, so it’s: git rm -r –cached .idea/*
well it tell you to add -r to your command : git rm -r –cached .idea/*
Owesome!!! You have to replace Kirill Likhodedov in jetbrains who usually just ignores users with regart to this question.