1

I just initialised a project directory to be a git local repo by doing git init

But ls -la shows that there is a hidden directory ".idea" which I think I don't need to track with my project. If that is correct, I tried to add it to my .gitignore buy just appending a ".idea/*" at the end of that file.

git status still shows the .idea/ listed.

Reading other posts on SO did not help me much since they are trying to stop tracking files which are already being tracked, or on the remote repo.
I am trying to start a fresh and ignore .idea/ from the very beginning and on the local repo before pushing anything to the remote repo. Thanks

Fred J.
  • 5,759
  • 10
  • 57
  • 106

1 Answers1

2

You can use git rm to remove the file in .idea folder from being tracked. What I usually do for my projects with Intellij IDEA, is like this :

git rm -r --cached .idea/

then

git add .
git commit -m "Excluded .idea from being tracked"
git push 

From this moment on, the git won't track the idea folder any more.

You can also take a look at the answers for this question.

Community
  • 1
  • 1
Farhad
  • 12,178
  • 5
  • 32
  • 60
  • 1
    (future / other readers) The "git add ." was a little weird for me. But this answer got that pesky .idea/ folder removed that someone checked in. Thanks. – granadaCoder Oct 08 '20 at 20:37