Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git status still shows DS_Store file even though it is in the ignore list

Tags:

git

In git ignore list I have:

build/**
.DS_Store

After updating some files git status shows:

modified:   db/main/res/.DS_Store

I did not expect to show that .DS_Store is modified because it is in ignore list. Working directory or project root is ~/myproj.

How to fix this problem?

like image 226
ace Avatar asked Sep 01 '25 10:09

ace


1 Answers

The ".DS_Store" entry in your .gitignore file will prevent new .DS_Store files being tracked by Git when you run git add.

It sounds like the problem in your case is that the .DS_Store file was being tracked by Git before you included .DS_Store in the .gitignore file.

So all you need to do is remove the .DS_Store file from the repo with git rm --cached db/main/res/.DS_Store and it won't be tracked from then on.

(added --cached following Edward's comment).

like image 107
tomp Avatar answered Sep 04 '25 07:09

tomp