0

Sorry if it sounds like a very simple question. But I'm still beginner. I already ignored .gitignore file itself and everything inside .idea folder. This is my .gitignore file:

\.gitignore
.idea/**

I'm working on a web project and trying to ignore a single file within a folder: config/db.php

but can't reach it. Appreciate any help!

Anshul Goyal
  • 67,326
  • 35
  • 140
  • 172
Scott
  • 3,608
  • 5
  • 31
  • 50

2 Answers2

2

First, it seems that you’ve already committed the files which you want to ignore. In that case, do:

git rm -rf -—cached .idea/ config/db.php

Next, correct your .gitignore file to have the following entries:

.gitignore
.idea/
config/db.php

Now, commit the changes in your .gitignore file:

git add .gitignore && git commit -m “Correct ignore files”
Anshul Goyal
  • 67,326
  • 35
  • 140
  • 172
0

You are probably already tracking the file. From the man page:

Files already tracked by Git are not affected;

So you first need to remove the file, and if you try to commit it again, you will get a warning.

andipla
  • 353
  • 4
  • 9