user3556757 user3556757 - 1 month ago 33
Git Question

removing entire .idea from a git repository via pycharm

I just migrated from atom/spyder to using PyCharm. I am writing a larger codebase now, so I decided to use Git, as I figured that will make it easier to stage the codebase to a remote server later. I'm totally new to Git.

I think I made a mistake, when creating the repository, of including the

.idea
subdirectory where Pycharm keeps all its own settings. This is something that is specific to me working on my local windows7 box; it never needs to be included in the repository.

workspace.xml
was constantly flagging as an updated file, so I used
git -r rm --cached .\.idea\
to try to remove all of it. the git shell seemed to succeed.

But when I go back into pycharm, and go to commit, it once again seems like it wants to update/add these files back to the repository?

enter image description here

Maybe I'm misunderstanding what's going on? But can anyone advise how to get to the point that git shell, pycharm, the repository all agree that .idea/ will no longer be maintained in the repository?

======================

I've created a
.gitignore
file at the same level as the .idea/
enter image description here

Pycharm also is told to ignore that directory
enter image description here

However, the log indicates it still wants to update/monitor these files:

enter image description here

Answer Source

Hi as you wanted you can ignore globally some files i guess is what you want and you can ignore locally some files.

If your (file wanted as ignored) are all ready staged you need to unstaged from repository :

git rm --cached .idea/*
//or
git update-index --assume-unchange .idea/*

Here how to do globally :

git config --global core.excludesfile ~/.gitignore_global

add the this file .gitignore_global

.gitignore
.idea/*

Here you can do it locally on root project :

1) create file .gitignore add this :

.gitignore
.idea/*

All are done.