Fred J.
Fred J.

Reputation: 6039

git to ignore a hidden directory in the local repo

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

Upvotes: 1

Views: 2714

Answers (1)

Farhad
Farhad

Reputation: 12996

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.

Upvotes: 2

Related Questions