Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gitignore won't ignore my .settings/ directory (created by eclipse)

git status:

Untracked files:
(use "git add <file>..." to include in what will be committed)
    .settings/

I've tried the following variations on my .gitignore file and nothing seems to work:

.settings/

*settings*

*.settings/

.settings/*

I've never had this much trouble with .gitignore, it usually just works. I must be doing something real dumb.

NOTE: My .gitignore file has more in it than just that one line (all the other lines works correctly).

like image 255
Sean Avatar asked May 26 '15 13:05

Sean


2 Answers

I thought I had the same problem. Turns out, the reason I kept seeing .settings/ in git status was because someone else already committed .settings/ to the repo. So, .settings/ kept showing up under the Changes not staged for commit files list because my IDE touched/changed this directory.

You want .settings/ to stay invisible to git so remove it from tracking. Then, when you make a change that touches this directory, you won't see it under the Untracked files list because you added it to the .gitignore file. Whoever committed .settings/ in the 1st place also won't see it as eligible for commit either because they updated their .gitignore file with your update to ignore .settings/ folder.

like image 64
Matthew Kuraja Avatar answered Nov 15 '22 18:11

Matthew Kuraja


/**/.settings/

worked to ignore the .settings folders below the root.

like image 36
J. Chaney Avatar answered Nov 15 '22 20:11

J. Chaney